fix: provide function to support hostname mapping#549
Conversation
|
Update: Just realize that this issue only happens when using cred store, please resolve |
| } | ||
|
|
||
| // convertHostname maps docker.io to registry-1.docker.io | ||
| func convertHostname(registry string) string { |
shizhMSFT
left a comment
There was a problem hiding this comment.
Please update this PR as discussed to use the credentials of https://index.docker.io/v1/ for docker.io when connecting registry-1.docker.io as docker.io. Meanwhile, please well document the docker behavior in the corresponding comment block.
Codecov Report
@@ Coverage Diff @@
## main #549 +/- ##
==========================================
- Coverage 70.72% 69.31% -1.41%
==========================================
Files 11 11
Lines 427 440 +13
==========================================
+ Hits 302 305 +3
- Misses 101 110 +9
- Partials 24 25 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
|
|
||
| // authClient assembles a oras auth client. | ||
| func (opts *Remote) authClient(debug bool) (client *auth.Client, err error) { | ||
| func (opts *Remote) authClient(host string, debug bool) (client *auth.Client, err error) { |
There was a problem hiding this comment.
Why we need this new argument? It's not used anywhere.
qweeah
left a comment
There was a problem hiding this comment.
Can you add a unit test case for this host name replacement?
| // According the the behavior of Docker CLI, | ||
| // credential should be added under key "https://index.docker.io/v1/" | ||
| hostname := opts.Hostname | ||
| if opts.Hostname == "docker.io" { |
There was a problem hiding this comment.
| if opts.Hostname == "docker.io" { | |
| if hostname == "docker.io" { |
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
16d8c5f to
c77a73a
Compare
Signed-off-by: Juncheng Zhu <junczhu@microsoft.com>
Resolve: #542
Signed-off-by: Juncheng Zhu junczhu@microsoft.com