From 01ddd87cb4ed38882e09d9c5228e6e8fe2f1fc53 Mon Sep 17 00:00:00 2001 From: Gustavo Valverde Date: Sun, 7 Jan 2024 23:26:17 +0000 Subject: [PATCH] fix(ci): revert script changes causing workflow failures (#8133) * fix(ci): revert script changes causing workflow failures * fix(ci): typo * fix(ci): use correct `DISK_OPTION` approach * fix(ci): revert find cached state disks * fix(ci): revert to previous `gcp-get-cached-disks.sh` script * chore: reduce diff and add TODO --- .github/workflows/sub-find-cached-disks.yml | 30 ++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sub-find-cached-disks.yml b/.github/workflows/sub-find-cached-disks.yml index 9e2730bef..898849ec8 100644 --- a/.github/workflows/sub-find-cached-disks.yml +++ b/.github/workflows/sub-find-cached-disks.yml @@ -69,5 +69,33 @@ jobs: env: GITHUB_WORKSPACE: ${{ env.GITHUB_WORKSPACE }} NETWORK: ${{ env.NETWORK }} # use lowercase version from env, not input + # TODO: Use the `gcp-get-available-disks.sh` script instead of the inline script, + # as this is crashing. And it might related to the returned JSON values. run: | - ./.github/workflows/scripts/gcp-get-available-disks.sh + # ./.github/workflows/scripts/gcp-get-available-disks.sh + LOCAL_STATE_VERSION=$(grep -oE "DATABASE_FORMAT_VERSION: .* [0-9]+" "$GITHUB_WORKSPACE/zebra-state/src/constants.rs" | grep -oE "[0-9]+" | tail -n1) + echo "STATE_VERSION: $LOCAL_STATE_VERSION" + LWD_TIP_DISK=$(gcloud compute images list --filter="status=READY AND name~lwd-cache-.+-[0-9a-f]+-v${LOCAL_STATE_VERSION}-${NETWORK}-tip" --format="value(NAME)" --sort-by=~creationTimestamp --limit=1) + if [[ -z "$LWD_TIP_DISK" ]]; then + echo "No TIP disk found for lightwalletd on network: ${NETWORK}" + echo "lwd_tip_disk=${{ toJSON(false) }}" >> "$GITHUB_OUTPUT" + else + echo "Disk: $LWD_TIP_DISK" + echo "lwd_tip_disk=${{ toJSON(true) }}" >> "$GITHUB_OUTPUT" + fi + ZEBRA_TIP_DISK=$(gcloud compute images list --filter="status=READY AND name~zebrad-cache-.+-[0-9a-f]+-v${LOCAL_STATE_VERSION}-${NETWORK}-tip" --format="value(NAME)" --sort-by=~creationTimestamp --limit=1) + if [[ -z "$ZEBRA_TIP_DISK" ]]; then + echo "No TIP disk found for Zebra on network: ${NETWORK}" + echo "zebra_tip_disk=${{ toJSON(false) }}" >> "$GITHUB_OUTPUT" + else + echo "Disk: $ZEBRA_TIP_DISK" + echo "zebra_tip_disk=${{ toJSON(true) }}" >> "$GITHUB_OUTPUT" + fi + ZEBRA_CHECKPOINT_DISK=$(gcloud compute images list --filter="status=READY AND name~zebrad-cache-.+-[0-9a-f]+-v${LOCAL_STATE_VERSION}-${NETWORK}-checkpoint" --format="value(NAME)" --sort-by=~creationTimestamp --limit=1) + if [[ -z "$ZEBRA_CHECKPOINT_DISK" ]]; then + echo "No CHECKPOINT disk found for Zebra on network: ${NETWORK}" + echo "zebra_checkpoint_disk=${{ toJSON(false) }}" >> "$GITHUB_OUTPUT" + else + echo "Disk: $ZEBRA_CHECKPOINT_DISK" + echo "zebra_checkpoint_disk=${{ toJSON(true) }}" >> "$GITHUB_OUTPUT" + fi