Skip to content

Commit

Permalink
small fix and explicity delete unused disk
Browse files Browse the repository at this point in the history
  • Loading branch information
areshand committed Dec 9, 2024
1 parent 95e0d68 commit fd073e2
Show file tree
Hide file tree
Showing 8 changed files with 242 additions and 106 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/provision-replay-verify-archive-disks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- ".github/workflows/provision-replay-verify-archive-disks.yaml"
- ".github/workflows/workflow-run-replay-verify-archive-storage-provision.yaml"
schedule:
- cron: "0 22 * * 1,3,5" # This runs every Mon,Wed,Fri
- cron: "0 8 * * 1,3,5" # This runs every Mon,Wed,Fri UTC 08:00

permissions:
contents: read
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
if: |
github.event_name == 'schedule' ||
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' && (inputs.NETWORK == 'testnet' || inputs.NETWORK == 'all')
github.event_name == 'workflow_dispatch' && (inputs.NETWORK == 'mainnet' || inputs.NETWORK == 'all')
needs: determine-test-metadata
uses: ./.github/workflows/workflow-run-replay-verify-archive-storage-provision.yaml
secrets: inherit
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/replay-verify-on-archive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ on:
- ".github/workflows/replay-verify-on-archive.yaml"
- ".github/workflows/workflow-run-replay-verify-on-archive.yaml"
schedule:
- cron: "0 22 * * 0,2,4" # The main branch cadence. This runs every Sun,Tues,Thurs
- cron: "0 8 * * 0,2,4" # The main branch cadence. This runs every Sun,Tues,Thurs UTC 08:00

permissions:
contents: read
Expand Down
29 changes: 26 additions & 3 deletions .github/workflows/workflow-run-replay-verify-on-archive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
GCP_SERVICE_ACCOUNT_EMAIL: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }}
EXPORT_GCP_PROJECT_VARIABLES: "false"
GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }}
GCP_AUTH_DURATION: "10800"

# Authenticate to Google Cloud the project is aptos-ci with credentails files generated
- name: Authenticate to Google Cloud
Expand Down Expand Up @@ -100,20 +101,42 @@ jobs:
CMD="$CMD --end ${{ inputs.END_VERSION }}"
fi
if [ -n "${{ inputs.IMAGE_TAG }}" ]; then
CMD="$CMD --end ${{ inputs.IMAGE_TAG }}"
if [ -n "${{ inputs.IMAGE_TAG }}" ]; then
CMD="$CMD --image_tag ${{ inputs.IMAGE_TAG }}"
fi
eval $CMD
timeout-minutes: 120
# This is in case user manually cancel the step above, we still want to cleanup the resources
- name: Post-run cleanup
env:
GOOGLE_CLOUD_PROJECT: aptos-devinfra-0
if: ${{ always() }}
run: |
cd testsuite/replay-verify
poetry run python main.py --network ${{ inputs.NETWORK }} --cleanup
CMD="poetry run python main.py --network ${{ inputs.NETWORK }}" --cleanup
if [ -n "${{ inputs.IMAGE_TAG }}" ]; then
CMD="$CMD --image_tag ${{ inputs.IMAGE_TAG }}"
fi
eval $CMD
echo "Cleanup completed"
# List all disks in the project that are not in use and finished creating. There is a rare chance that the disk is being created and won't be used in future due to csi retry errors
# But this disk will be deleted in the next workflow run since its status is READY then
- name: Delete all unsed disks in the project
env:
GOOGLE_CLOUD_PROJECT: aptos-devinfra-0
if: ${{ always() }}
run: |
DISK_URIS=$(gcloud compute disks list --filter="-users:* AND status=READY" --format "value(uri())")
echo "Disks to be deleted:"
echo $DISK_URIS
if [ -n "$DISK_URIS" ]; then
gcloud compute disks delete $DISK_URIS
else
echo "No unused disks found."
fi
Expand Down
Loading

0 comments on commit fd073e2

Please sign in to comment.