From 66ede081966f15c604b3d226e548b4e3dc635476 Mon Sep 17 00:00:00 2001 From: Dan Pock Date: Tue, 10 Dec 2024 13:11:50 -0500 Subject: [PATCH] Correct PR image tags SHA Currently the SHA - based on the action - seems to not be aware of the branch. So it always uses the head SHA of the default branch. This change ensures it uses the SHA of the PR at the time it's built. --- .github/workflows/pr-debug-publish.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-debug-publish.yaml b/.github/workflows/pr-debug-publish.yaml index 25e08a86..b2b9dc77 100644 --- a/.github/workflows/pr-debug-publish.yaml +++ b/.github/workflows/pr-debug-publish.yaml @@ -40,7 +40,7 @@ jobs: echo "Fetching details for PR #$pr_number" pr_response=$(gh api repos/${{ github.repository }}/pulls/$pr_number) head_sha=$(echo "$pr_response" | jq -r '.head.sha') - echo "::set-output name=head_sha::$head_sha" + echo "head_sha=$head_sha" >> $GITHUB_OUTPUT - name: Checkout PR Head uses: actions/checkout@v3 with: @@ -60,7 +60,7 @@ jobs: with: images: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}/helm-locker tags: | - type=sha,prefix=pr-${{ github.event.inputs.pr_number }}- + type=raw,prefix=pr-${{ github.event.inputs.pr_number }}-${{ steps.get_head_sha.outputs.head_sha }} type=raw,value=pr-${{ github.event.inputs.pr_number }} - name: Build and push helm-locker image id: push @@ -78,7 +78,7 @@ jobs: with: images: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}/helm-project-operator tags: | - type=sha,prefix=pr-${{ github.event.inputs.pr_number }}- + type=raw,prefix=pr-${{ github.event.inputs.pr_number }}-${{ steps.get_head_sha.outputs.head_sha }} type=raw,value=pr-${{ github.event.inputs.pr_number }} - name: Build Helm-Project-Operator image uses: docker/build-push-action@v5 @@ -95,7 +95,7 @@ jobs: with: images: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }} tags: | - type=sha,prefix=pr-${{ github.event.inputs.pr_number }}- + type=raw,prefix=pr-${{ github.event.inputs.pr_number }}-${{ steps.get_head_sha.outputs.head_sha }} type=raw,value=pr-${{ github.event.inputs.pr_number }} - name: Build Prometheus Federator image uses: docker/build-push-action@v5