-
Notifications
You must be signed in to change notification settings - Fork 548
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
Add partial.ImageByPlatform helper #797
Conversation
Codecov Report
@@ Coverage Diff @@
## master #797 +/- ##
==========================================
+ Coverage 74.72% 74.75% +0.02%
==========================================
Files 103 104 +1
Lines 4313 4313
==========================================
+ Hits 3223 3224 +1
Misses 612 612
+ Partials 478 477 -1
Continue to review full report at Codecov.
|
pkg/v1/partial/index.go
Outdated
|
||
// ImageByArch returns the v1.Image belonging to the v1.ImageIndex with the | ||
// matching OS and Architecture. | ||
func ImageByArch(w WithRawIndexManifest, os, arch string) (v1.Image, 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.
I'd almost rather have this return a WithRawManifest
or something given that, in theory, an index could have a child index with a platform field, but I understand that it would make the calling code more cumbersome.
Since child image is by far the common case, I'm fine merging this, but I'm not 100% happy about it :)
78e4488
to
6979a89
Compare
6979a89
to
ba06322
Compare
ba06322
to
be52d93
Compare
This is used by ko now in a couple places, and it seems like a useful helper to provide in general. Reuse this helper in pkg/v1/remote/
be52d93
to
a8e1d56
Compare
|
||
// WithRawIndexManifest defines the subset of v1.ImageIndex used by ImageByArch. | ||
type WithRawIndexManifest interface { | ||
RawManifest() ([]byte, 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.
I'm actually concerned that this is too general because a v1.Image
that also implements Image(Hash)
will satisfy this, but will not work at all because v1.Image
's descriptors are under Layers
. Should we just have ImageByPlatform
take a v1.ImageIndex
instead?
Closing in favor of #823 |
This is used by ko now in a couple places, and it seems like a useful
helper to provide in general.
Reuse this helper in
pkg/v1/remote/