-
Notifications
You must be signed in to change notification settings - Fork 76
copy: add InstancePlatforms field for platform-based filtering #656
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
Open
aguidirh
wants to merge
2
commits into
containers:main
Choose a base branch
from
aguidirh:sparse-manifest-platforms-pr1938
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum… we have multi-compression images (where there is a gzip instance and a zstd instance for the same platform). This would only copy one of the instances.
OTOH a trivial “does the instance match the required
Platformvalue” check might copy too much, because a v1 variant requirement would match a v1,v2,v3 instances.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the feedback! You're right that using
ChooseInstanceByCompression()only copies one instance per platform, potentially missing multi-compression variants.Proposed Solution
Default behavior: Copy ALL compression variants for platforms specified in
InstancePlatforms. This preserves all available data for selected platforms, maintains the original digest for each instance, and avoids implicit filtering.For compression-specific selection: Introduce a wrapper struct that allows optional compression filtering:
Usage Examples
Copy all compressions (default, most common):
Filter to specific compressions:
Different compressions per platform:
Rationale
Better UX: Platform-based selection should be inclusive by default. Users shouldn't lose compression variants unless explicitly requested.
Avoids digest lookup: The whole point of
InstancePlatformsis convenience. While users could use theInstancesfield with exact digests for compression-specific control, this would require manually looking up digests for each compression variant—a poor user experience that defeats the purpose of platform-based selection.Clear semantics:
InstancePlatforms= broad selection (by platform)Instances= precise selection (by digest)Compressionsfield = optional filterFuture extensibility: Using a wrapper struct that we control (rather than directly exposing
imgspecv1.Platform) makes it easier to extend in the future. We can add new fields for additional filtering or options without being constrained by the external OCI spec types.Not a breaking change: Since
InstancePlatformsis new in this PR, we can get the design right before it becomes public API.Does this approach address your concerns? I'm happy to implement it if you agree with the direction.