ci: Generate and sign provenance information as image layer for SLSA lvl 3 #504
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, this PR adds provenance information to the policy-reporter image as a layer, effectively raising its SLSA level to 3.
I've tried to be as less invasive as possible when adding this to the GHA workflow. In this PR:
ci: Generate and sign provenance info as image layer. Configure docker buildx to generate provenance attestations as explained in https://docs.docker.com/build/metadata/attestations/slsa-provenance.
Then, sign the provenance attestation layer. For that, find the specific layer digest that corresponds to that provenance attestation, both for linux/amd64 and linux/arm64 architectures, and sign it.
ci: Use github.repository_owner instead of hardcoded org. This allows to test the CI workflows in a fork, and to not need push permissions to production OCI registry namespace under ghcr.io/kyverno.
As an example of a GHA run, from my fork:
https://github.com/viccuad/policy-reporter/actions/runs/11270355378/job/31340877023
Resulting ghcr package:
https://github.com/users/viccuad/packages/container/package/policy-reporter
Looking forward to the review! Please tell me if a different approach is desired, I can open a different PR if so. Still, felt it was easier to have the conversation with an approach already.