-
Notifications
You must be signed in to change notification settings - Fork 201
feat: oras backup
to backup artifacts to a directory or a tar
#1790
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
f7b4dee
to
2e443c4
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1790 +/- ##
==========================================
- Coverage 85.54% 85.28% -0.27%
==========================================
Files 137 141 +4
Lines 6006 6429 +423
==========================================
+ Hits 5138 5483 +345
- Misses 617 671 +54
- Partials 251 275 +24 ☔ 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>
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>
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 implements a new oras backup
command that allows users to back up artifacts from a registry into an OCI image layout. The backup can be saved either as a directory or a tar archive, and supports backing up artifacts with their referrers.
Key changes include:
- New
backup
command with support for directory and tar output formats - Backup functionality with optional referrer inclusion
- Extended graph operations for recursive referrer discovery
Reviewed Changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
cmd/oras/root/backup.go | Main backup command implementation with artifact resolution and output handling |
cmd/oras/root/backup_test.go | Comprehensive unit tests for backup command functionality |
test/e2e/suite/command/backup.go | End-to-end tests covering various backup scenarios |
internal/graph/graph.go | Enhanced graph operations with recursive referrer finding functionality |
internal/io/tar_utils.go | Utility functions for creating tar archives from directories |
cmd/oras/internal/display/ | Status and metadata handlers for backup progress display |
Comments suppressed due to low confidence (1)
internal/graph/graph.go:108
- The function name
FindPredecessors
is misleading as it returns referrers, not predecessors. Consider renaming toFindReferrers
to better reflect its actual functionality.
func FindPredecessors(ctx context.Context, src oras.ReadOnlyGraphTarget, descs []ocispec.Descriptor, opts oras.ExtendedCopyGraphOptions) ([]ocispec.Descriptor, error) {
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 backup
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 backup -h
:oras backup mcr.microsoft.com/oss/v2/oras-project/oras:v1.2.3 -o backup.tar
:./oras backup mcr.microsoft.com/oss/v2/oras-project/oras --include-referrers -o backup
:Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Spec: #1767
Resolves part of #1366
Please check the following list: