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

add check for forge images #15007

Merged
merged 2 commits into from
Nov 13, 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
27 changes: 27 additions & 0 deletions .github/workflows/workflow-run-forge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,33 @@ jobs:
shell: bash
run: gcloud config set project aptos-forge-gcp-0

- name: Check for Forge images
if: ${{ !inputs.SKIP_JOB }}
id: check-forge-images
run: |
check_image_exists() {
local tag=$1
local image_name=$2
local output_prefix=$3
if [[ -n "$tag" ]]; then
if docker manifest inspect us-docker.pkg.dev/aptos-registry/docker/${image_name}:${tag} &> /dev/null; then
echo "${output_prefix}_EXISTS=true" >> $GITHUB_OUTPUT
echo "${output_prefix}_TAG=$tag" >> $GITHUB_OUTPUT
echo "✅ $image_name image found for tag: $tag" >> $GITHUB_STEP_SUMMARY
else
echo "${output_prefix}_EXISTS=false" >> $GITHUB_OUTPUT
echo "⚠️ No $image_name image found for tag: $tag. The latest available image will be used instead." >> $GITHUB_STEP_SUMMARY
Copy link
Contributor

@ibalajiarun ibalajiarun Nov 12, 2024

Choose a reason for hiding this comment

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

Is it easy to print which image will be used if latest? Also, where will this be posted on a PR job?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's code around getting the latest image in forge.py that I didn't want to duplicate here. This is mostly to prompt users to use the CICD: build-images label when running Forge tests against their PR. Users can still see the actual images being used by checking the workflow logs

The output shows up in the workflow summary https://github.com/aptos-labs/aptos-core/actions/runs/11410691190

Copy link
Contributor

Choose a reason for hiding this comment

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

May be we should think about unifying these logic in a future PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I think the logic to determine the images belongs in GHA. We should pull out the image tags to inputs/outputs to make the Forge runs reproducible. Right now if we rerun the workflow, it could result in different images being used

fi
fi
}

check_image_exists "${{ inputs.GIT_SHA }}" "validator" "VALIDATOR_GIT_SHA"
check_image_exists "${{ inputs.IMAGE_TAG }}" "validator" "VALIDATOR_IMAGE_TAG"
check_image_exists "${{ inputs.GIT_SHA }}" "forge" "FORGE_GIT_SHA"
check_image_exists "${{ inputs.FORGE_IMAGE_TAG }}" "forge" "FORGE_IMAGE_TAG"

echo "ℹ️ If testing Forge changes, ensure the 'CICD: build-images' label is added to your PR and the image build workflow has completed successfully." >> $GITHUB_STEP_SUMMARY

- name: Run pre-Forge checks
if: ${{ !inputs.SKIP_JOB }}
shell: bash
Expand Down
Loading