Skip to content

Commit 112f42e

Browse files
committed
Fixes error with incorrect sha format for attestation
Signed-off-by: Geoff Wilson <geoff@gr-oss.io>
1 parent 8d3e650 commit 112f42e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/docker-build.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ jobs:
120120
platforms: linux/amd64
121121

122122
- name: Push to registries
123+
id: push
123124
run: |
124125
for registry in ${{ steps.registries.outputs.registries }}; do
125126
echo "Pushing to ${registry}..."
@@ -130,10 +131,16 @@ jobs:
130131
done
131132
done
132133
134+
# Capture the image digest from ghcr.io for attestation
135+
first_tag=$(echo "${{ steps.tags.outputs.tags }}" | awk '{print $1}')
136+
digest=$(docker inspect --format='{{index .RepoDigests 0}}' "ghcr.io/pulp/${{ env.IMAGE_NAME }}:${first_tag}" | cut -d'@' -f2)
137+
echo "digest=${digest}" >> $GITHUB_OUTPUT
138+
echo "Image digest: ${digest}"
139+
133140
- name: Generate artifact attestation
134141
if: github.event_name != 'pull_request'
135142
uses: actions/attest-build-provenance@v1
136143
with:
137144
subject-name: ghcr.io/pulp/${{ env.IMAGE_NAME }}
138-
subject-digest: ${{ hashFiles('Dockerfile') }}
145+
subject-digest: ${{ steps.push.outputs.digest }}
139146
push-to-registry: true

0 commit comments

Comments
 (0)