fix(ci): fix broken release, address issue during attestation step#1589
fix(ci): fix broken release, address issue during attestation step#1589viccuad merged 2 commits intokubewarden:mainfrom
Conversation
The SLSA provenance predicate was changed to a different value, this caused a digest to be empty, leading to a cascaded failure. - Replace `slsa.dev/provenance/v0.2` with `v1` (`docker/build-push-action` v6 generates v1): this is the actual fix - Add empty-digest guards on attestation, provenance, and SBOM lookup steps: this will provide a more clear message if something like that happens again. - Add missing `-r` flag to jq in SBOM digest step: this is a minor improvemnt. It prevents double quuotes to land into the `crane` command later on. Signed-off-by: Flavio Castelli <fcastelli@suse.com> Assisted-by: Claude Sonnet 4.6
There was a problem hiding this comment.
Pull request overview
Fixes a broken release workflow by aligning SLSA predicate-type detection with the provenance version produced by current container build tooling, and improves failure diagnostics when expected digests/attestations are missing.
Changes:
- Update provenance predicate lookup from
https://slsa.dev/provenance/v0.2tohttps://slsa.dev/provenance/v1. - Add guards to fail early with clearer error messages when attestation/provenance/SBOM digests are empty.
- Use
jq -rfor SBOM digest extraction to avoid quoted output being passed into later commands.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| DIGEST=$(crane manifest ghcr.io/${{github.repository_owner}}/${{ inputs.component }}@${{ env.ATTESTATION_MANIFEST_DIGEST}} | \ | ||
| jq '.layers | map(select(.annotations["in-toto.io/predicate-type"] == "https://spdx.dev/Document")) | map(.digest) | join(" ")') | ||
| jq -r '.layers | map(select(.annotations["in-toto.io/predicate-type"] == "https://spdx.dev/Document")) | map(.digest) | join(" ")') |
There was a problem hiding this comment.
This concern is valid, although we don't hit it for now. Tried locally the command, and it has a syntax error. It should be:
$ crane manifest ghcr.io/kubewarden/policy-server@sha256:b26b51ad913d21eccfdda6637e6783b8a04801dcb4c71adea59739d5df14c2dc | jq -r '.layers | map(select(.annotations["in-toto.io/predicate-type"] == "https://spdx.dev/Document")) | map(.digest) | if length == 0 then empty elif length == 1 then .[0] else error("ERROR: Multiple SBOM layers found in attestation manifest") end'
sha256:ba74f6c49f8403307a17f02db70f01be6e3ca551eb6c89b00a1f93f0fae437b7
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1589 +/- ##
==========================================
- Coverage 80.02% 79.93% -0.09%
==========================================
Files 127 127
Lines 16573 16573
==========================================
- Hits 13262 13248 -14
- Misses 3311 3325 +14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Víctor Cuadrado Juan <vcuadradojuan@suse.de>
7fc419a to
7cff672
Compare
viccuad
left a comment
There was a problem hiding this comment.
Thanks again for the investigation!
The SLSA provenance predicate was changed to a different value, this caused a digest to be empty, leading to a cascaded failure.
slsa.dev/provenance/v0.2withv1(docker/build-push-actionv6 generates v1): this is the actual fix-rflag to jq in SBOM digest step: this is a minor improvemnt. It prevents double quuotes to land into thecranecommand later on.