-
Notifications
You must be signed in to change notification settings - Fork 201
feat: add oras restore
command
#1792
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
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1792 +/- ##
==========================================
- Coverage 85.28% 85.25% -0.04%
==========================================
Files 141 143 +2
Lines 6429 6739 +310
==========================================
+ Hits 5483 5745 +262
- Misses 671 706 +35
- Partials 275 288 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
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.
Pull Request Overview
This PR introduces a new oras restore
command that complements the existing oras backup
command, allowing users to restore artifacts from OCI image layouts back to registries. The command supports both directory and tar archive inputs, dry-run mode, referrer handling, and various distribution specifications.
- Implements the
oras restore
command with comprehensive CLI options and error handling - Adds extensive E2E test coverage for restore functionality including edge cases
- Integrates display handlers for both status and metadata output
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
cmd/oras/root/restore.go |
Main implementation of the restore command with options parsing and execution logic |
test/e2e/suite/command/restore.go |
Comprehensive E2E test suite covering restore scenarios and error cases |
cmd/oras/internal/display/status/tty.go |
TTY-based status display handler for restore operations |
cmd/oras/internal/display/status/text.go |
Text-based status display handler for restore operations |
cmd/oras/internal/display/metadata/text/restore.go |
Text metadata handler for restore command output |
cmd/oras/root/cmd.go |
Integration of restore command into the main CLI |
test/e2e/suite/command/backup.go |
Updates to backup tests for consistency with restore command |
cmd/oras/root/backup.go |
Minor documentation and error message improvements |
Comments suppressed due to low confidence (7)
test/e2e/suite/command/restore.go:142
- The function
strings.SplitSeq
does not exist in the Go standard library. This should likely bestrings.Split
instead.
for referrerDgst := range strings.SplitSeq(strings.TrimSpace(string(referrers)), "\n") {
test/e2e/suite/command/restore.go:198
- The function
strings.SplitSeq
does not exist in the Go standard library. This should likely bestrings.Split
instead.
for referrerDgst := range strings.SplitSeq(strings.TrimSpace(string(referrers)), "\n") {
test/e2e/suite/command/restore.go:316
- The function
strings.SplitSeq
does not exist in the Go standard library. This should likely bestrings.Split
instead.
for referrerDgst := range strings.SplitSeq(strings.TrimSpace(string(referrers)), "\n") {
test/e2e/suite/command/restore.go:415
- The function
strings.SplitSeq
does not exist in the Go standard library. This should likely bestrings.Split
instead.
for referrerDgst := range strings.SplitSeq(strings.TrimSpace(string(referrers)), "\n") {
test/e2e/suite/command/restore.go:504
- The function
strings.SplitSeq
does not exist in the Go standard library. This should likely bestrings.Split
instead.
for referrerDgst := range strings.SplitSeq(strings.TrimSpace(string(referrers)), "\n") {
test/e2e/suite/command/restore.go:606
- The function
strings.SplitSeq
does not exist in the Go standard library. This should likely bestrings.Split
instead.
for referrerDgst := range strings.SplitSeq(strings.TrimSpace(string(referrers)), "\n") {
test/e2e/suite/command/restore.go:631
- The function
strings.SplitSeq
does not exist in the Go standard library. This should likely bestrings.Split
instead.
for referrerDgst := range strings.SplitSeq(strings.TrimSpace(string(referrers)), "\n") {
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
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
What this PR does / why we need it:
Add a new command
oras restore
and the corresponding tests.Spec: https://github.com/oras-project/oras/blob/main/docs/proposals/backup-restore.md
The command looks like this:

oras -h
:oras restore -h
:oras restore --input backup localhost:5000/restore-oras-250804
:oras restore --input backup localhost:5000/restore-oras-250804 --dry-run
:Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #1366
Please check the following list: