-
Notifications
You must be signed in to change notification settings - Fork 2k
cli/command: Reapply "remove uses of GetAuthConfigKey, ParseRepositoryInfo" and add test #5969
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
It's currently slower because it calls registry.ParseRepositoryInfo, which does a DNS lookup for hostnames to determine if they're a loopback address (and marked "insecure"); go test -v -run TestRetrieveAuthTokenFromImage === RUN TestRetrieveAuthTokenFromImage === RUN TestRetrieveAuthTokenFromImage/no-prefix === RUN TestRetrieveAuthTokenFromImage/docker.io === RUN TestRetrieveAuthTokenFromImage/index.docker.io === RUN TestRetrieveAuthTokenFromImage/registry-1.docker.io === RUN TestRetrieveAuthTokenFromImage/registry.hub.docker.com === RUN TestRetrieveAuthTokenFromImage/[::1] === RUN TestRetrieveAuthTokenFromImage/[::1]:5000 === RUN TestRetrieveAuthTokenFromImage/127.0.0.1 === RUN TestRetrieveAuthTokenFromImage/localhost === RUN TestRetrieveAuthTokenFromImage/localhost:5000 === RUN TestRetrieveAuthTokenFromImage/no-auth.example.com --- PASS: TestRetrieveAuthTokenFromImage (0.35s) --- PASS: TestRetrieveAuthTokenFromImage/no-prefix (0.00s) --- PASS: TestRetrieveAuthTokenFromImage/docker.io (0.00s) --- PASS: TestRetrieveAuthTokenFromImage/index.docker.io (0.00s) --- PASS: TestRetrieveAuthTokenFromImage/registry-1.docker.io (0.08s) --- PASS: TestRetrieveAuthTokenFromImage/registry.hub.docker.com (0.12s) --- PASS: TestRetrieveAuthTokenFromImage/[::1] (0.13s) --- PASS: TestRetrieveAuthTokenFromImage/[::1]:5000 (0.00s) --- PASS: TestRetrieveAuthTokenFromImage/127.0.0.1 (0.00s) --- PASS: TestRetrieveAuthTokenFromImage/localhost (0.00s) --- PASS: TestRetrieveAuthTokenFromImage/localhost:5000 (0.00s) --- PASS: TestRetrieveAuthTokenFromImage/no-auth.example.com (0.01s) PASS ok github.com/docker/cli/cli/command 1.367s Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
…yInfo" This reverts commit f596202, and reapplies 79141ce. > cli/command: remove uses of GetAuthConfigKey, ParseRepositoryInfo > > Re-implement locally, based on the code in github.com/docker/docker/registry, > but leaving out bits that are not used on the client-side, such as > configuration of Mirrors, and configurable insecure-registry, which > are not used on the client side. This commit contains a regression due to a typo in `authConfigKey`; const authConfigKey = "https:/index.docker.io/v1/" Which is missing a `/` after the scheme. Which currently fails the TestRetrieveAuthTokenFromImage test. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This was introduced in 79141ce, which was reverted in f596202, and re-applied in the previous commit. Before this patch, saving credentials worked correctly; docker login -u thajeztah Password: Login Succeeded cat ~/.docker/config.json { "auths": { "https://index.docker.io/v1/": { "auth": "REDACTED" } } } But when resolving the credentials, the credentials stored would not be found; docker pull -q thajeztah/private-test-image Error response from daemon: pull access denied for thajeztah/private-test-image, repository does not exist or may require 'docker login': denied: requested access to the resource is denied With this patch applied: docker pull -q thajeztah/private-test-image docker.io/thajeztah/private-test-image:latest Thanks to mtrmac (Miloslav Trmač) for spotting this mistake! Suggested-by: Miloslav Trmač <mitr@redhat.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5969 +/- ##
==========================================
+ Coverage 59.09% 59.13% +0.03%
==========================================
Files 354 354
Lines 29733 29739 +6
==========================================
+ Hits 17572 17587 +15
+ Misses 11191 11178 -13
- Partials 970 974 +4 🚀 New features to boost your workflow:
|
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.
let's hope this one doesn't get reverted :)
@vvoland ptal 🤗 |
Bringing this in; just was discussing with @vvoland if we wanted to squash the "fix the regression" commit with the "Reapply" commit (I kept it separate to make it more visible), because it could impact Let's hope that's the case indeed (otherwise blame me!) |
cli/command: add unit-test for RetrieveAuthTokenFromImage
It's currently slower because it calls registry.ParseRepositoryInfo,
which does a DNS lookup for hostnames to determine if they're a loopback
address (and marked "insecure");
Reapply "cli/command: remove uses of GetAuthConfigKey, ParseRepositoryInfo"
This reverts commit f596202, and reapplies
79141ce.
This commit contains a regression due to a typo in
authConfigKey
;Which is missing a
/
after the scheme.Which currently fails the TestRetrieveAuthTokenFromImage test.
cli/command: fix regression in resolving auth from config
This was introduced in 79141ce, which
was reverted in f596202, and re-applied
in the previous commit.
Before this patch, saving credentials worked correctly;
But when resolving the credentials, the credentials stored would not be found;
With this patch applied:
Thanks to @mtrmac (Miloslav Trmač) for spotting this mistake!
Note that this PR also improves performance, as no DNS lookups happen to determine
if the registry is a loopback (and "insecure");
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)