-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
client/driver: use correct repo address when using docker-credential helper #4266
Changes from 1 commit
bbb3d74
e99304e
46c557c
d3c138e
6e86c4e
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 |
---|---|---|
|
@@ -2130,13 +2130,15 @@ func authFromHelper(helperName string) authBackend { | |
helper := dockerAuthHelperPrefix + helperName | ||
cmd := exec.Command(helper, "get") | ||
|
||
// Ensure that the HTTPs prefix exists | ||
if !strings.HasPrefix(repo, "https://") { | ||
repo = fmt.Sprintf("https://%s", repo) | ||
repoInfo, err := parseRepositoryInfo(repo) | ||
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. Can we get a test |
||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
cmd.Stdin = strings.NewReader(repo) | ||
// Ensure that the HTTPs prefix exists | ||
repoAddr := fmt.Sprintf("https://%s", repoInfo.Hostname()) | ||
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. is it safe to assume everyone uses https for internal hubs 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. This is whats passed to the helper. The docs only ever show examples with https, but even some of the major cloud registry helpers like AWS ECR and Google GCR strip the https if it exists comming in and do the look up based solely on the domain name. |
||
|
||
cmd.Stdin = strings.NewReader(repoAddr) | ||
output, err := cmd.Output() | ||
if err != nil { | ||
switch err.(type) { | ||
|
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.
Can we say what case is fixed? I am assuming it worked for some subset of image specification formats
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 it was a fluke that it worked for gcr as the implementation didn’t follow the current spec. Maybe it changed along the way? I don’t think it’s used much outside of GCE.
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.
Okay the two I know of are GCR and AWS:
https://github.com/awslabs/amazon-ecr-credential-helper
https://github.com/GoogleCloudPlatform/docker-credential-gcr
Also we should like to only GH-4266. This PR should mark those two issues as closed.
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.
Yeah it looks like the aws helper's regex doesn't care whats after the hostname.
GCR is using URL.Parse and verifying the Host is a part of GCR.
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.
the gcloud helper which i just found out is actually an alias into the google cloud sdk expects the url to be one of these