Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update schedule and add input checking for replay-verify on archive #15501

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this UTC? (You said you switch to night)

- cron: "0 8 * * 1,3,5" # This runs every Mon,Wed,Fri UTC 08:00

permissions:
contents: read
@@ -56,8 +56,7 @@ jobs:
provision-mainnet:
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
2 changes: 1 addition & 1 deletion .github/workflows/replay-verify-on-archive.yaml
Original file line number Diff line number Diff line change
@@ -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
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
@@ -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
@@ -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"

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gcloud compute disks delete command expects each disk URI as a separate argument. The current syntax will pass all URIs as a single argument, causing the command to fail. Consider updating to:

echo "$DISK_URIS" | xargs -r gcloud compute disks delete

The -r flag ensures xargs only runs if there are disk URIs to process.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

if [ -n "$DISK_URIS" ]; then
gcloud compute disks delete $DISK_URIS
else
echo "No unused disks found."
fi



Loading