-
Notifications
You must be signed in to change notification settings - Fork 612
Add platform option to crane copy and digest #742
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
Conversation
40a6738 to
a141030
Compare
1e2b4e7 to
4f5579f
Compare
Codecov Report
@@ Coverage Diff @@
## master #742 +/- ##
==========================================
- Coverage 79.39% 78.99% -0.41%
==========================================
Files 102 102
Lines 4683 4717 +34
==========================================
+ Hits 3718 3726 +8
- Misses 534 551 +17
- Partials 431 440 +9
Continue to review full report at Codecov.
|
|
I moved the logic to the Digest and Manifest function. Does not look super nice, but is probably easier to understand than the logic I used before with the interface. |
pkg/crane/manifest.go
Outdated
| return nil, err | ||
| } | ||
| return desc.Manifest, nil | ||
| return img.RawManifest() |
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.
This will still fail for schema 1 images, which we aren't able to satisfy the v1.Image interface for. If we keep the behavior the same here, but only try to resolve to an image when platform is specified, I think we can keep everything working, i.e.:
if o.platform != nil {
img, err := desc.Image()
if err != nil {
return nil, err
}
return img.RawManifest()
}
return desc.Manifest, nilSorry for all the back and forth on this, I really appreciate your contribution!
92e4497 to
1d42505
Compare
47be60c to
213c3d9
Compare
Codecov Report
@@ Coverage Diff @@
## master #742 +/- ##
==========================================
- Coverage 75.94% 75.55% -0.39%
==========================================
Files 102 102
Lines 4144 4169 +25
==========================================
+ Hits 3147 3150 +3
- Misses 546 565 +19
- Partials 451 454 +3
Continue to review full report at Codecov.
|
|
Tried to change the logic according to your points in the last review, squashed the commits and rebased them on master. |
I think what you've done is the best we can do. |
jonjohnsonjr
left a comment
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.
LGTM, thanks!
Add platform option to crane copy and digest. If the remote reference is an index/list it only copies the image which matches the specified platform.
This would be a possible solution for #741