Skip to content

chore(ux): give recommendation when empty creds found during basic auth#1235

Merged
qweeah merged 61 commits into
oras-project:mainfrom
qweeah:client-auth-error
Jan 19, 2024
Merged

chore(ux): give recommendation when empty creds found during basic auth#1235
qweeah merged 61 commits into
oras-project:mainfrom
qweeah:client-auth-error

Conversation

@qweeah

@qweeah qweeah commented Jan 9, 2024

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:
This PR improves the error output when doing basic authentication.
Before

$ oras pull localhost:7000/test:123 --registry-config test.config 
Error: failed to resolve 123: GET "http://localhost:7000/v2/test/manifests/123": credential required for basic auth

After

$ oras pull localhost:7000/test:123 --registry-config test.config
Error: failed to resolve 123: basic credential not found
Please check whether the registry credential stored in the authentication file at "test.config" is correct

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Depends on merging of #1222, resolves #1236

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Wwwsylvia pushed a commit to oras-project/oras-go that referenced this pull request Jan 17, 2024
…ath (#674)

Two changes proposed in this PR
1) When failed to fetch credentials for basic auth, return a new error
2) Add a new function to DynamicStore

An example usage of the proposed change: oras-project/oras#1235,
resolves #676

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
@qweeah qweeah changed the title WIP: chore(ux): give recommendation when empty creds found during basic auth chore(ux): give recommendation when empty creds found during basic auth Jan 18, 2024
@qweeah qweeah marked this pull request as ready for review January 18, 2024 02:21
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
@codecov

codecov Bot commented Jan 18, 2024

Copy link
Copy Markdown

Codecov Report

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

Comparison is base (0514a57) 81.46% compared to head (76d7e80) 81.55%.

Files Patch % Lines
cmd/oras/internal/option/remote.go 84.00% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1235      +/-   ##
==========================================
+ Coverage   81.46%   81.55%   +0.09%     
==========================================
  Files          68       68              
  Lines        3749     3789      +40     
==========================================
+ Hits         3054     3090      +36     
- Misses        487      490       +3     
- Partials      208      209       +1     

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

Signed-off-by: Billy Zha <jinzha1@microsoft.com>

@shizhMSFT shizhMSFT left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with suggestions

Comment thread cmd/oras/internal/option/remote.go Outdated

@shizhMSFT shizhMSFT left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@qweeah qweeah merged commit 812bb59 into oras-project:main Jan 19, 2024
FeynmanZhou pushed a commit to FeynmanZhou/oras that referenced this pull request May 11, 2024
…th (oras-project#1235)

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Feynman Zhou <feynmanzhou@microsoft.com>
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.

improve error message when registry credential config is not valid

2 participants