-
Notifications
You must be signed in to change notification settings - Fork 528
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
crane push: Support OCI layout #1208
Conversation
Detect if the first argument is a directory. If so, attempt to read it as an OCI image layout and push to the destination if it contains a single image.
nice! Will TAL. |
cmd/crane/cmd/push.go
Outdated
if len(m.Manifests) != 1 { | ||
return nil, errors.New("pushing multiple images from layout not yet supported (PRs welcome)") | ||
} | ||
return l.Image(m.Manifests[0].Digest) |
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.
Haven't you marked this as Fixes: #{the issue covering pushing layouts}
?
Maybe we should leave one open
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.
There are ~3 ways I can imagine people wanting to use this, let's chat.
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.
Did we resolve the next steps here? I'm fine with landing this part as-is, assuming it's good enough for kaniko
's --oci-layout
. However, I'd like a clear path for how we support the same for ko
.
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.
Can you add a little roundtrip e2e test where we crane pull
-> crane push
-> crane pull
and check for diffs?
For extra credit, I'd love to check that it works with https://github.com/GoogleContainerTools/kaniko/blob/master/README.md#--oci-layout-path
I think the main thing I'd want to see to land this is a roundtrip test, but otherwise it LGTM. I'd even be fine if we plan to change the roundtrip test as the semantics of how we handle single images evolves later, I mostly want the confidence that things WAI. |
Alternately (or additionally), a test that runs |
Codecov Report
@@ Coverage Diff @@
## main #1208 +/- ##
=======================================
Coverage 74.55% 74.55%
=======================================
Files 111 111
Lines 8048 8048
=======================================
Hits 6000 6000
Misses 1464 1464
Partials 584 584 Continue to review full report at Codecov.
|
Make sure we can roundtrip images through an OCI layout.
cmd/crane/cmd/push.go
Outdated
}, | ||
} | ||
cmd.Flags().BoolVar(&index, "index", false, "Push the collection of images as a single index") |
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.
My interpretation of this text is that the fallback behavior is to push N images instead, which is not what the code does, so perhaps some clarity is called for there?
Use type switch. Elaborate in description of --index flag.
Detect if the first argument is a directory. If so, attempt to read it
as an OCI image layout and push to the destination if it contains a
single image.
Fixes #726
Fixes #1116