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
This commit is contained in:
Gustavo Valverde 2024-01-07 23:26:17 +00:00 committed by GitHub
parent 45e3f5e354
commit 01ddd87cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 29 additions and 1 deletions

View File

@ -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