Use a generic alphabetical pattern rather than a regex group

Google Cloud doesn't seem to support regex groups.
This commit is contained in:
teor 2022-05-13 10:53:13 +10:00
parent e335d5ad86
commit 970afe7b17
1 changed files with 5 additions and 3 deletions

View File

@ -215,15 +215,17 @@ jobs:
# Try to find an image generated from the main branch
# Fields are listed in the "Create image from state disk" step
#
# TODO: require ${NETWORK} in the name after PR #4391 merges to main and runs a full sync
CACHED_DISK_NAME=$(gcloud compute images list --verbosity=debug --filter="name~${{ inputs.disk_prefix }}-main-[0-9a-f]+-v${LOCAL_STATE_VERSION}-(${NETWORK})?-${{ inputs.disk_suffix }}" --format="value(NAME)" --sort-by=~creationTimestamp --limit=1)
# TODO: require ${NETWORK} in the name after PR #4391 merges to main, and runs a full sync
# network should replace [a-z]*
CACHED_DISK_NAME=$(gcloud compute images list --verbosity=debug --filter="name~${{ inputs.disk_prefix }}-main-[0-9a-f]+-v${LOCAL_STATE_VERSION}-[a-z]*-${{ inputs.disk_suffix }}" --format="value(NAME)" --sort-by=~creationTimestamp --limit=1)
echo "main Disk: $CACHED_DISK_NAME"
if [[ -z "$CACHED_DISK_NAME" ]]; then
# Try to find an image generated from any other branch
#
# TODO: require ${NETWORK} in the name after PRs #4391 and #4385 merge to main
CACHED_DISK_NAME=$(gcloud compute images list --verbosity=debug --filter="name~${{ inputs.disk_prefix }}-.+-[0-9a-f]+-v${LOCAL_STATE_VERSION}-(${NETWORK})?-${{ inputs.disk_suffix }}" --format="value(NAME)" --sort-by=~creationTimestamp --limit=1)
# network should replace [a-z]*
CACHED_DISK_NAME=$(gcloud compute images list --verbosity=debug --filter="name~${{ inputs.disk_prefix }}-.+-[0-9a-f]+-v${LOCAL_STATE_VERSION}-[a-z]*-${{ inputs.disk_suffix }}" --format="value(NAME)" --sort-by=~creationTimestamp --limit=1)
echo "Disk: $CACHED_DISK_NAME"
fi