Skip to content
New issue

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

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

Already on GitHub? # to your account

Use Docker digest instead of tag to attest provenance #3296

Merged
merged 1 commit into from
Feb 3, 2025
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
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,15 @@ jobs:
CURRENT_TAG: ${{ github.ref_name }}
run: |
for IMG_NAME in $(yq e '.dockers[].image_templates[0]' .goreleaser.yaml | grep PRIME_REGISTRY | sed "s/{{ .Env.PRIME_REGISTRY }}/${PRIME_REGISTRY}/g" | sed "s/{{ .Tag }}/${CURRENT_TAG}/g"); do
# Extract Docker image reference plus digest from local image
IMAGE=$(docker inspect --format='{{index .RepoDigests 0}}' ${IMG_NAME})

max_retries=3
retry_delay=5
i=0

while [ "${i}" -lt "${max_retries}" ]; do
if slsactl download provenance --format=slsav1 "${IMG_NAME}" > provenance-slsav1.json; then
if slsactl download provenance --format=slsav1 "${IMAGE}" > provenance-slsav1.json; then
break
fi
if [ "${i}" -eq "$(( max_retries - 1 ))" ]; then
Expand All @@ -159,7 +162,7 @@ jobs:
sleep "${retry_delay}"
done

cosign attest --yes --predicate provenance-slsav1.json --type slsaprovenance1 "${IMG_NAME}"
cosign attest --yes --predicate provenance-slsav1.json --type slsaprovenance1 "${IMAGE}"
done

- name: Upload charts to release
Expand Down
Loading