-
Notifications
You must be signed in to change notification settings - Fork 181
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
feat(oci-layout): support in oras cp
#748
Conversation
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #748 +/- ##
==========================================
- Coverage 70.12% 63.96% -6.17%
==========================================
Files 18 19 +1
Lines 616 702 +86
==========================================
+ Hits 432 449 +17
- Misses 153 222 +69
Partials 31 31 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
cmd/oras/cp.go
Outdated
|
||
Example - Copy the artifact tagged with 'v1' from repository 'localhost:5000/net-monitor' to 'localhost:5000/net-monitor-copy' with multiple tags and concurrency level tuned | ||
oras cp --concurrency 6 localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:v1,tag2,tag3 | ||
Example - Copy the artifacts: |
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.
@FeynmanZhou I have grouped examples by features, can you help review, thanks!
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
cmd/oras/cp.go
Outdated
Example - Copy the artifact tagged 'v1': | ||
oras cp localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:v1 # copy between repositories | ||
oras cp localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy # copy without tagging in the destination | ||
oras cp --to-oci localhost:5000/net-monitor:v1 test:v1 # download into an OCI layout folder 'test' | ||
oras cp --from-oci test:v1 localhost:5000/net-monitor:v1 # upload from an OCI layout folder 'test' | ||
oras cp --from-oci test.tar:v1 localhost:5000/net-monitor:v1 # upload from an OCI layout tar archive 'test.tar' | ||
|
||
Example - Copy the artifact tagged 'v1' and its referrers: | ||
oras cp -r localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:v1 # copy between repositories | ||
oras cp -r --to-oci localhost:5000/net-monitor:v1 test:v1 # download into an OCI image layout folder 'test' | ||
oras cp -r --from-oci test:v1 localhost:5000/net-monitor:v1 # upload from an OCI image layout folder 'test' | ||
|
||
Example - Copy certain platform of the artifact 'v1': | ||
oras cp --platform linux/arm/v5 localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:v1 # copy between repositories | ||
oras cp --platform linux/arm/v5 --to-oci localhost:5000/net-monitor:v1 test:v1 # download into an OCI layout folder 'test' | ||
oras cp --platform linux/arm/v5 --from-oci test:v1 localhost:5000/net-monitor:v1 # upload from an OCI layout folder 'test' | ||
|
||
Example - Copy the artifact 'v1' with multiple tags: | ||
oras cp localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:tag1,tag2,tag3 # copy between repositories | ||
oras cp --concurrency 10 localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:tag1,tag2,tag3 # copy between repositories with concurrency level tuned | ||
oras cp localhost:5000/net-monitor:v1 test:tag1,tag2,tag3 --to-oci # download into an OCI layout folder 'test' | ||
oras cp test:v1 localhost:5000/net-monitor-copy:tag1,tag2,tag3 --from-oci # upload from an OCI layout folder 'test' |
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.
Those examples will be wrapped by terminals, rendering hard to read for users.
@FeynmanZhou we might need to have a better way to present the examples.
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
cmd/oras/cp.go
Outdated
oras cp --concurrency 6 localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:v1,tag2,tag3 | ||
Example - Copy the artifact tagged 'v1': | ||
oras cp localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy:v1 # copy between repositories | ||
oras cp localhost:5000/net-monitor:v1 localhost:5000/net-monitor-copy # copy without tagging in the destination |
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 think from a customers perspective --to-oci
would be to an oci registry. I feel like it would be more intuitive to say --to-file
or a little worse to me --to-directory
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.
Thinking about it more, I like the --to=format
and --from=format
better because that would leave the possibility of other formats other than registry and directory. Having a TGZ format would be very handy for example. Having an input of stdin or stndout might be convenient as well.
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 oci image layout is not a format but a layout, see spec
So for short flags, how about --from-layout
, --to-layout
for oras cp
and --layout
to other commands?
--layout
is equivalent to --layout type=oci
. To support more layouts in the future, we can add --layout type=docker
(just taking docker image layout as an example, doesn't mean we need to support it)
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 elaborate on the scenarios of using an input of stdin? To me the UX sounds looks like below:
some-cmd | oras cp - localhost/owner/name:v1
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.
Also for uploading .tgz
image layout, I might take a closer look tomorrow to see if it's already supported or what we need to do to support it.
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.
Having an input of stdin or stndout might be convenient as well.
Currently, oras
/ oras-go
requires random access for read and write for performance considerations, and thus stdin
and stdout
are not supported. Maybe we can consider that after oras v1.0.0
, trading convenience off performance.
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 don't want to get too side tracked by all the possible formats and destinations, but also don't want to design into a corner. It definitely might be convenient to support stdin/stdout for example, but maybe that should be done in another command. The tgz thing also might make more sense for another command since tgz input/output make sense for multiple repositories.
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.
It definitely might be convenient to support stdin/stdout for example, but maybe that should be done in another command. The tgz thing also might make more sense for another command since tgz input/output make sense for multiple repositories.
@TerryHowe Can you help create enhancement issues with detailed scenario for those? We can continue discussion there.
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 think from a customers perspective --to-oci would be to an oci registry. I feel like it would be more intuitive to say --to-file or a little worse to me --to-directory.
@TerryHowe To avoid ambiguity, how about using --to-oci-layout
and --from-oci-layout
in oras copy
respectively?
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.
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
oras cp
oras cp
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
Related to oras-project#378 Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Related to #378