diff --git a/.github/workflows/workflow-run-forge.yaml b/.github/workflows/workflow-run-forge.yaml index 05d0251194f8c..e95b2133a94ad 100644 --- a/.github/workflows/workflow-run-forge.yaml +++ b/.github/workflows/workflow-run-forge.yaml @@ -180,6 +180,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 + 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 @@ -228,3 +255,4 @@ jobs: # Print out whether the job was skipped. - run: echo "Skipping forge test!" if: ${{ inputs.SKIP_JOB }} +