-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Update login to use token handling code from distribution #20832
Conversation
Further differentiate the APIEndpoint used with V2 with the endpoint type which is only used for v1 registry interactions Rename Endpoint to V1Endpoint and remove version ambiguity Use distribution token handler for login Signed-off-by: Derek McGowan <[email protected]> Signed-off-by: Aaron Lehmann <[email protected]>
Experimental failure looks like a flaky test (cc @thaJeztah: can you please make sure we track that one?)
|
Interesting. I saw the same failure on janky in #20831. I don't remember seeing this often in the past. I wonder if something in the tests has changed recently in a way that made this more flaky. |
@aaronlehmann possibly because someone changed the test in #20411 😇 😉 |
I think the fix in #20411 was not harmful, but it was insufficient. I'll open a PR that might help. |
@aaronlehmann I know, just teasing 👍 |
LGTM |
LGTM 🎉 |
LGTM |
Update login to use token handling code from distribution
This PR lays the groundwork for a future PR to add OAuth registry authentication (see distribution/distribution#1418 and distribution/distribution#1475). Before this can happen,
docker login
needs to use the token handling code indocker/distribution
instead of using a separate implementation.The main purpose of this PR is to make
docker login
use token handling logic defined indocker/distribution
, like push and pull already do. However, there's a fair amount of cleanup here as well. The idea is to simplify thelogin
code and clean up the technical debt here so the upcoming PR to add OAuth will be a relatively simple change that can be easily reviewed.The main changes here are:
LookupPullEndpoints
to take a hostname instead parsing a full image reference to extract the hostnameEndpoint
toV1Endpoint
to make clear it is only used in v1 flowsgetToken
function that duplicates token handling code in thegithub.aaakk.us.kg/docker/distribution/registry/client/auth
auth package. Use the vendored code instead.This was originally written by @dmcgowan. I am submitting the PR on his behalf (with a few minor edits of my own), since he is away for the next few days.