Skip to content

Conversation

TerryHowe
Copy link
Member

What this PR does / why we need it:

This PR adds a very limited backup and restore command. Backup and restore in this PR are only supported in OCI Layout format. For example:

oras backup --output ./mirror registry.k8s.io/kube-apiserver-arm64:v1.31.0 registry.k8s.io/kube-apiserver-arm64:v1.32.0 registry.k8s.io/kube-controller-manager-arm64:v1.31.0

And restore to Zot:

oras restore --input ./mirror localhost:15000

@TerryHowe TerryHowe marked this pull request as draft July 4, 2025 00:43
Copy link

codecov bot commented Jul 4, 2025

Codecov Report

Attention: Patch coverage is 22.39748% with 246 lines in your changes missing coverage. Please review.

Project coverage is 82.17%. Comparing base (e913ef1) to head (f1c3960).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/oras/root/backup.go 12.30% 113 Missing and 1 partial ⚠️
cmd/oras/root/restore.go 23.40% 103 Missing and 5 partials ⚠️
cmd/oras/internal/option/target.go 23.07% 20 Missing ⚠️
cmd/oras/internal/display/metadata/text/backup.go 50.00% 4 Missing ⚠️

❌ Your patch status has failed because the patch coverage (22.39%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1769      +/-   ##
==========================================
- Coverage   85.43%   82.17%   -3.26%     
==========================================
  Files         137      140       +3     
  Lines        5951     6268     +317     
==========================================
+ Hits         5084     5151      +67     
- Misses        616      860     +244     
- Partials      251      257       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shizhMSFT
Copy link
Contributor

I wrote a bash-based prototype. Hope it can give some insights.

@TerryHowe
Copy link
Member Author

I wrote a bash-based prototype. Hope it can give some insights.

Yes.

The only thing you have that I was not thinking of is # usage: oras restore [flags] <registry>/<repository>[:<ref1>[,<ref2>...]] [...] I think that should be # usage: oras restore [flags] <registry>[/<repository>[:<ref1>[,<ref2>...]] [...]] adding the capability to copy everything. That would be how you'd want it to work for mirroring for example. In the specification right now, it only supports # usage: oras restore [flags] <registry>

@TerryHowe TerryHowe force-pushed the backup-and-restore branch from 34ef20f to 21b0e75 Compare July 8, 2025 00:23
@TerryHowe TerryHowe force-pushed the backup-and-restore branch 3 times, most recently from 7e444b6 to 9f3a07a Compare July 8, 2025 17:39
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
@TerryHowe TerryHowe force-pushed the backup-and-restore branch from 9f3a07a to f4c1288 Compare July 8, 2025 17:44
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
@TerryHowe TerryHowe force-pushed the backup-and-restore branch from f4c1288 to f1c3960 Compare July 9, 2025 01:20
@TerryHowe TerryHowe closed this Jul 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants