feat: oras backup to backup artifacts to a directory or a tar#1790
Merged
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>
shizhMSFT
reviewed
Jul 30, 2025
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>
Contributor
There was a problem hiding this comment.
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
backupcommand 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
FindPredecessorsis misleading as it returns referrers, not predecessors. Consider renaming toFindReferrersto 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>
shizhMSFT
reviewed
Jul 31, 2025
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
shizhMSFT
reviewed
Jul 31, 2025
This was referenced Aug 5, 2025
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Add a new command
oras backupand 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: