-
Notifications
You must be signed in to change notification settings - Fork 217
fix: Fallback to blob upload when cross-repo mount fails #1924
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
base: main
Are you sure you want to change the base?
Conversation
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 adds automatic fallback to regular blob upload when cross-repository blob mount fails due to permission errors. ORAS currently fails when Harbor or other registries deny mount requests from private repositories the user doesn't have access to. This change makes the tool resilient by retrying the operation without the mount optimization when permission-related errors are detected.
Key Changes:
- Refactored copy logic into a reusable
executeCopyclosure to enable retry functionality - Added error detection and retry logic that disables mounting when authorization failures occur
- Maintained all existing copy paths (recursive, empty reference, and standard copy)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
shizhMSFT
left a comment
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.
Other parts of the code looks fine.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1924 +/- ##
==========================================
- Coverage 87.22% 87.20% -0.02%
==========================================
Files 143 143
Lines 5540 5549 +9
==========================================
+ Hits 4832 4839 +7
- Misses 421 423 +2
Partials 287 287 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: bupd <[email protected]>
Signed-off-by: bupd <[email protected]>
Signed-off-by: bupd <[email protected]>
|
@shizhMSFT , @Wwwsylvia fixed review comments, Thanks for the review. |
TerryHowe
left a comment
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
ORAS currently fails to push when registry(Harbor) denies a cross-repository blob mount, which happens when the destination user lacks access to the source project. In private registries this is common, making mount attempts unreliable.
This PR makes ORAS automatically fall back to a normal blob upload when the mount is denied, matching expected registry client behavior and ensuring pushes succeed even without cross-project permissions.
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 #1892
Please check the following list: