containerimage: use policyimage.ResolveAttestationStatements#6825
Draft
smerkviladze wants to merge 1 commit into
Draft
containerimage: use policyimage.ResolveAttestationStatements#6825smerkviladze wants to merge 1 commit into
smerkviladze wants to merge 1 commit into
Conversation
Replace the private addAttestationBlobs function with a call to the shared implementation in github.com/moby/policy-helpers/image. The deduplication of blobs against ac.Blobs that addAttestationBlobs performed is preserved at the call site. This consolidates the attestation-walking logic so that moby/buildkit and moby/moby can share a single implementation rather than each carrying its own copy. Signed-off-by: Sopho Merkviladze <smerkviladze@mirantis.com>
corhere
reviewed
Jun 3, 2026
Comment on lines
+278
to
+281
| ac.Blobs[b.Descriptor.Digest] = sourceresolver.Blob{ | ||
| Descriptor: b.Descriptor, | ||
| Data: b.Data, | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| ac.Blobs[b.Descriptor.Digest] = sourceresolver.Blob{ | |
| Descriptor: b.Descriptor, | |
| Data: b.Data, | |
| } | |
| ac.Blobs[b.Descriptor.Digest] = sourceresolver.Blob(b) |
In Go, values of one struct type are convertible to values of another struct type if both have the same fields with the same name and type, in the same order.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
WIP
Replaces BuildKit's private
addAttestationBlobsfunction insource/containerimage/source.gowith a call to the sharedResolveAttestationStatementsfunction in moby/policy-helpers/pull/30.Both functions do the same work: walk the layers of an attestation manifest, filter them by in-toto predicate type, fetch matching blobs, and add them to the attestation chain.
What changed:
addAttestationBlobsfromsource/containerimage/source.go;policyimage.ResolveAttestationStatementsplus a small loop that merges the result intoac.Blobswhile preserving the original "skip if already fetched" deduplication.External behaviour is unchanged.
Testing:
This change is covered by existing integration tests:
testImageResolveProvenanceAttestationtestImageResolveAttestationChainLocaltestImageResolveAttestationChainRequiresNetwork