Repository navigation
fix: Fallback to blob upload when cross-repo mount fails - #1924
Conversation
There was a problem hiding this comment.
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.
Other parts of the code looks fine.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1924 +/- ##
==========================================
- Coverage 87.23% 87.21% -0.02%
==========================================
Files 138 138
Lines 5467 5476 +9
==========================================
+ Hits 4769 4776 +7
- Misses 417 419 +2
Partials 281 281 ☔ View full report in Codecov by Harness. 🚀 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. |
|
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
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: