-
-
Notifications
You must be signed in to change notification settings - Fork 549
feat: allow saving specific platforms for an image #3218
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
base: main
Are you sure you want to change the base?
feat: allow saving specific platforms for an image #3218
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
2dcc37c
to
b5a1892
Compare
b5a1892
to
a1213e5
Compare
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.
Thanks for this, I've done a quick pass with a few improvement suggestions.
@@ -1784,8 +1784,30 @@ func (p *DockerProvider) ListImages(ctx context.Context) ([]ImageInfo, error) { | |||
return images, nil | |||
} | |||
|
|||
func SaveImageOptionWithPlatforms(plaforms ...specs.Platform) SaveImageOption { |
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.
suggestion: add comment for all public methods, more in other files.
question: could this have a simpler name, WithPlatforms or SaveImagesWithPlatforms
return p.SaveImagesWithOps(ctx, output, images) | ||
} | ||
|
||
// SaveImages exports a list of images as an uncompressed tar |
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.
suggestion: correct description which refers to the old name
Platforms []specs.Platform | ||
} | ||
|
||
type SaveImageOption func(*SaveOptions) |
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.
suggestion: return an error so its future proof for extensions.
@@ -10,9 +12,16 @@ type ImageInfo struct { | |||
Name string | |||
} | |||
|
|||
type SaveOptions struct { | |||
Platforms []specs.Platform |
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.
suggestion: keep details private so changes can be used without breaking the API.
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.
The reason I need it is for the K3S module so I would have to implement a duplicate type in that module
require.NoErrorf(t, err, "failed to get provider") | ||
|
||
defer func() { | ||
_ = provider.Close() |
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.
suggestion: check the error.
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.
Clicking the right option this time 😄
What does this PR do?
This introduces a way to pass image save options (like platform) to the image client. This allows saving a specific architecture for an image.
Why is it important?
With OCI multi-arch images, it is sometimes needed to save image for a different architecture than the current one. This changes allows to control the behavior instead of defaulting to the current platform.