Skip to content
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 new commands to support uploading and downloading images #1366

Open
1 task
qweeah opened this issue Apr 23, 2024 · 8 comments
Open
1 task

Add new commands to support uploading and downloading images #1366

qweeah opened this issue Apr 23, 2024 · 8 comments
Labels
enhancement New feature or request spec required Issues that require specifications
Milestone

Comments

@qweeah
Copy link
Contributor

qweeah commented Apr 23, 2024

What is the version of your ORAS CLI

oras v1.1.0

What would you like to be added?

Had an offline discussion with @shizhMSFT and he suggests to add two commands:

  • oras backup (alias: snapshot, pull-image) to support saving an image from remote registry to an OCI image layout tar archive.
Usage:
  oras backup --output <oci_layout_path> <reg>/<repo>[{:<tag>|@digest]}] [...]
  • oras restore (alias: push-image) to support pushing an image from an OCI image layout tar archive to remote registry.
Usage:
  oras restore --output <reg>/<repo> <oci_layout_path>[{:<tag>|@digest]}]

Why is this needed for ORAS?

oras cp is not intuitive to use, e.g. user might use oras push to push images from an OCI layout and succeed with false positive (see #1353). Adding those two wrapper commands of oras cp can help avoid that.

Are you willing to submit PRs to contribute to this feature?

  • Yes, I am willing to implement it.
@qweeah qweeah added enhancement New feature or request triage New issues or PRs to be acknowledged by maintainers labels Apr 23, 2024
@TerryHowe
Copy link
Member

TerryHowe commented Apr 23, 2024 via email

@shizhMSFT
Copy link
Contributor

Why not backup and restore?

Nice input. I've revised the proposal accordingly to oras backup and marked snapshot as an alias.

@qweeah qweeah removed the triage New issues or PRs to be acknowledged by maintainers label May 7, 2024
@qweeah qweeah added this to the v1.3.0 milestone May 7, 2024
@shizhMSFT shizhMSFT added the spec required Issues that require specifications label Jul 24, 2024
@sajayantony
Copy link
Contributor

Could you also include reasoning why pull doesn't work here.

oras pull --to-oci-layout <oci_layout_path> <reg>/<repo>[{:<tag>|@digest]}] [...]

@sajayantony
Copy link
Contributor

As per the call I'm ok if we limit to tar archive only dealing.

@shizhMSFT
Copy link
Contributor

shizhMSFT commented Jul 24, 2024

As per the call, here is an alternative without introducing new commands.

  • oras backup --> oras pull --archive <tar_path> <name>{:<tag>|@<digest>}
  • oras restore --> oras push --archive <tar_path> <name>[:<tag>[,<tag>][...]] <file>[:<type>] [...]

The major difference between oras backup/restore and oras pull/push is that oras backup/restore can take multiple images across registries and repositories.

Example usages are

# working with remote registry
oras pull localhost:5000/hello:v1 --archive hello.tar # backup hello:v1 to hello.tar
oras push localhost:5000/hello:v1 --archive hello.tar # restore hello:v1 from hello.tar

# working with entire repository
oras pull localhost:5000/hello --archive hello.tar # backup all images in hello to hello.tar
oras push localhost:5000/hello --archive hello.tar # restore all images in hello.tar

# working with multiple images
oras pull localhost:5000/hello:v1,foo,bar --archive hello.tar # backup v1, foo, and bar
oras push localhost:5000/hello:v1,foo --archive hello.tar     # restore v1 and foo, and ignore bar

# working with referrers
oras pull --include-referrers localhost:5000/hello:v1 --archive hello.tar
oras push --include-referrers localhost:5000/hello:v1 --archive hello.tar

# working with OCI layout. UX would be better if using `oras cp`.
oras pull --oci-layout layout.tar:v1 --archive hello.tar
oras pull --oci-layout layout-dir:v1 --archive hello.tar
oras push --oci-layout layout-dir:v1 --archive hello.tar

@qweeah
Copy link
Contributor Author

qweeah commented Jul 24, 2024

oras restore --> oras push --archive <tar_path> [:[,][...]] [:] [...]

I think the usage is change to oras push <name>[:<tag>[,<tag>][...]] {<file>[:<type>] [...]|--archive <tar_path>}.

@TerryHowe
Copy link
Member

Currently, pull skips successors though, right?

@qweeah
Copy link
Contributor Author

qweeah commented Jul 24, 2024

Currently, pull skips successors though, right?

Depends on the type. subject are skipped unless --include-subject is specified. manifests in an index will be pulled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request spec required Issues that require specifications
Projects
None yet
Development

No branches or pull requests

4 participants