Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Make config layers in ociremote mountable #3741

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

jonjohnsonjr
Copy link
Contributor

@jonjohnsonjr jonjohnsonjr commented Jun 18, 2024

The wrapping that oci.Signatures does hides the ConfigLayer() implementation in remote.Image that remote.Write relies on for determining if it can mount the config blob (vs having to re-upload it), so remote.Write is sending additional blob uploads, which incurs an additional roundtrip that we don't really need to do.

Explicitly implement ConfigLayer() in the wrappers by dispatching to the wrapped implementation fixes this.

Before this change, this check fails due to the wrapping:

https://github.com/google/go-containerregistry/blob/1b4e4078a545f2b6f96766a064b45ee77cdbefdd/pkg/v1/partial/with.go#L102-L104

Which means we get back this fallback implementation: https://github.com/google/go-containerregistry/blob/1b4e4078a545f2b6f96766a064b45ee77cdbefdd/pkg/v1/partial/with.go#L52-L88

Which means this check fails: https://github.com/google/go-containerregistry/blob/1b4e4078a545f2b6f96766a064b45ee77cdbefdd/pkg/v1/remote/write.go#L364

So we didn't attempt to mount.

https://go.dev/play/p/2kW3-XbdjmM

The wrapping that oci.Signatures does hides the ConfigLayer()
implementation in remote.Image that remote.Write relies on for
determining if it can mount the config blob (vs having to re-upload it),
so remote.Write is sending additional blob uploads, which incurs an
additional roundtrip that we don't really need to do.

Explicitly implement ConfigLayer() in the wrappers by dispatching to the
wrapped implementation fixes this.

Signed-off-by: Jon Johnson <jon.johnson@chainguard.dev>
Copy link

codecov bot commented Jun 18, 2024

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 40.63%. Comparing base (2ef6022) to head (9432efd).
Report is 132 commits behind head on main.

Files Patch % Lines
pkg/oci/remote/image.go 0.00% 2 Missing ⚠️
pkg/oci/remote/signatures.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3741      +/-   ##
==========================================
+ Coverage   40.10%   40.63%   +0.52%     
==========================================
  Files         155      158       +3     
  Lines       10044    10179     +135     
==========================================
+ Hits         4028     4136     +108     
- Misses       5530     5543      +13     
- Partials      486      500      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mattmoor mattmoor merged commit 5209b38 into sigstore:main Jun 18, 2024
21 checks passed
@github-actions github-actions bot added this to the v2.3.0 milestone Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants