-
Notifications
You must be signed in to change notification settings - Fork 395
Add support for registry paths in auth.json #1278
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
Conversation
vrothberg
left a comment
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 walk the path. Let's assume we pull quay.io/repo/image:tag, I'd like the code to be able to find the following credentials in order:
- quay.io/repo/image
- quay.io/repo (to separate credentials for different users)
- quay.io (also to remain backwards compat)
mtrmac
left a comment
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.
We’ll also need the write path (login/logout). Is that expected to be a separate PR? (That’s fine if so, this PR is big enough already — just to make sure this is on the radar.)
Note to self: Only skimmed the tests for now.
Yes, let's follow-up on this one in another PR. |
mtrmac
left a comment
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.
WIP, to shorten the iteration cycle.
Overall looks good, I still need to read the tests.
docker/docker_client.go
Outdated
| v1Res := &V1Results{} | ||
|
|
||
| // Get credentials from authfile for the underlying hostname | ||
| // nolint: staticcheck |
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.
Is there a way to silence that specific warning and not everything from that linter?
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.
Yes, by adding a custom rules go .golangci.yml. Changed to use that instead of the comment.
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.
Ouch, that‘s worse than silencing the checker, and the ideal fix doesn’t work: golangci/golangci-lint#741
I have ended up with
//lint:ignore SA1019 We can't use GetCredentialsForRef because we want to search the whole registry.
auth, err := config.GetCredentials(sys, registry) //nolint:staticcheck // https://github.com/golangci/golangci-lint/issues/741so that both a direct invocation of staticcheck and use via golangci-lint don’t complain.
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.
Fixed, thank you for your suggestion.
mtrmac
left a comment
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.
A full review now.
Still checking for URLs even if the caller submits a ref (because the primary caller is going to always submit one) is the only non-trivial concern, the rest is just nits and small cleanups.
vrothberg
left a comment
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.
LGTM
This patch adds support for `host[:port]/ns/…repo` to auth.json while keeping the backwards compatible behavior. Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
mtrmac
left a comment
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.
Thanks!
This patch adds support for
host[:port]/ns/…repoto auth.json while keeping the backwards compatible behavior.Refers to #1276