-
Notifications
You must be signed in to change notification settings - Fork 605
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
Make the ServerAddress optional for the main docker registry. #1315
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,7 +201,7 @@ func NewAuthCreds(refHostname string) (AuthCreds, error) { | |
// - ac.ServerAddress: "https://index.docker.io/v1/". | ||
if !isAuthConfigEmpty(ac) { | ||
if authConfigHostname == registry.IndexServer { | ||
if ac.ServerAddress != registry.IndexServer { | ||
if ac.ServerAddress != "" && ac.ServerAddress != registry.IndexServer { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: To preserve the behaviour of printing the debug log on if ac.ServerAddress == "" {
// This can happen with Amazon ECR: https://github.com/containerd/nerdctl/issues/733
logrus.Debugf("failed to get ac.ServerAddress for authConfigHostname=%q (refHostname=%q)",
authConfigHostname, refHostname)
} else if authConfigHostname == registry.IndexServer {
if ac.ServerAddress != registry.IndexServer {
return nil, fmt.Errorf("expected ac.ServerAddress (%q) to be %q", ac.ServerAddress, registry.IndexServer)
}
} else {
acsaHostname := credentials.ConvertToHostname(ac.ServerAddress)
if acsaHostname != authConfigHostname {
return nil, fmt.Errorf("expected the hostname part of ac.ServerAddress (%q) to be authConfigHostname=%q, got %q",
ac.ServerAddress, authConfigHostname, acsaHostname)
}
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ericpromislow @jandubois ↑ LGTY? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AkihiroSuda Yes, LGTM, and I've tested that it fixes the repro case specified in #1308 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW, @ericpromislow is still away, so you won't get any feedback from him for at least another 10 days. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jandubois Thanks for testing and providing the info @ktock Please add your commit to this PR (or just open a new PR)? |
||
return nil, fmt.Errorf("expected ac.ServerAddress (%q) to be %q", ac.ServerAddress, registry.IndexServer) | ||
} | ||
} else if ac.ServerAddress == "" { | ||
|
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.
I think we should enforce the default registry when it is empty for all
refHostname