Skip to content
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: 7 additions & 0 deletions pkg/image/containersimageregistry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ func (r *Registry) Pull(ctx context.Context, ref orimage.Reference) error {
SourceCtx: sourceCtx,
DestinationCtx: r.cache.getSystemContext(),
OptimizeDestinationImageAlreadyExists: true,

// We use the OCI layout as a temporary storage and
// pushing signatures for OCI images is not supported
// so we remove the source signatures when copying.
// Signature validation will still be performed
// accordingly to a provided policy context.
RemoveSignatures: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we also want

PreserveDigests: true,

It doesn't impact this particular operation, but it also seems a good option which doesn't default on.
I verified that this works with upstream (unsigned) and downstream (signed) example catalogs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GoDoc for that field is:

// Preserve digests, and fail if we cannot.

I'm hesitant about the "fail if we cannot" part. We have similar code in operator-controller that does not set this value, so I don't think it is necessary, and likely not for this bug fix specifically.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it's not necessary for resolving this bug. But the bug arose because we didn't consider other fields that might've been pertinent when we introduced the new containers/image registry support, so it felt like we should at least discuss any other possible missed configuration.

I think we can agree that mutating digests across our local copy would be an undesirable side effect.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, even skopeo has this option as a non-main-path flag, which suggests that there are conditions under which this is desirable, but not in general.
If we wanted this, we should plumb through a controlling flag. Which I don't think we need to do, at this time.

}); err != nil {
return err
}
Expand Down
Loading