oras-project / oras-go

ORAS Go library
https://oras.land
Apache License 2.0
179 stars 96 forks source link

feat: add a host-based auth cache as a fallback #651

Closed ktarplee closed 9 months ago

ktarplee commented 10 months ago

This PR adds a new exported method called NewRobustCache() and changes the DefaultCache to use the robust cache. The robust cache uses scoped based auth but falls back to host based auth to better handle the situations described in #650 but retain the benefits of scoped based auth (where the token for a repo might be different than another repo in the same registry).

Closes #650

ktarplee commented 10 months ago

This PR obviously still needs

shizhMSFT commented 9 months ago

@ktarplee Would you like to update this PR to reflect the latest discussion in #650?

ktarplee commented 9 months ago

@ktarplee Would you like to update this PR to reflect the latest discussion in #650?

I made the name change.

codecov[bot] commented 9 months ago

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (faaa1dd) 75.41% compared to head (25e15fc) 75.46%.

Files Patch % Lines
registry/remote/auth/cache.go 82.35% 4 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #651 +/- ## ========================================== + Coverage 75.41% 75.46% +0.04% ========================================== Files 59 59 Lines 5606 5640 +34 ========================================== + Hits 4228 4256 +28 - Misses 1015 1019 +4 - Partials 363 365 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

ktarplee commented 9 months ago

I also added unit tests for the hostCache and exported NewSingleContextCache() function. @shizhMSFT

shizhMSFT commented 9 months ago

@ktarplee LoL. The DCO check failed. Could you fix that?