This repository has been archived by the owner on Mar 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 550
Support loading auth config for repos with no scheme in their URL #910
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Support loading auth configuration for repos when their `serverAddress` is specified with no scheme component but their entry in the configuration file includes a scheme component. Older versions of Docker write authentication tokens to the configuration file including their scheme ("https://") but newer onces do not. Thus in order to allow people to use the newer format (looking up auth for a repo that isn't prefixed with scheme) with an older configuration file we try prefixing the `serverAddress` with "http://" in some cases. Fixes spotify#804
Codecov Report
@@ Coverage Diff @@
## master #910 +/- ##
============================================
+ Coverage 66.04% 66.08% +0.03%
- Complexity 769 771 +2
============================================
Files 171 171
Lines 3240 3249 +9
Branches 369 372 +3
============================================
+ Hits 2140 2147 +7
- Misses 940 942 +2
Partials 160 160 |
davidxia
previously approved these changes
Nov 13, 2017
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 for the PR. Just one thing to address.
try { | ||
final URI serverAddressUri = new URI(serverAddress); | ||
if (serverAddressUri.getScheme() == null) { | ||
final String addrWithProto = "https://" + 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.
Let's also check with http://
.
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.
Sure, will do.
davidxia
approved these changes
Nov 13, 2017
@mattnworb @caipre How does this look? |
caipre
approved these changes
Nov 14, 2017
Hi! Has this been released yet? |
Yes, should be in latest docker-client. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Support loading auth configuration for repos when their
serverAddress
is specified with no scheme component but their entry in the configuration
file includes a scheme component.
Older versions of Docker write authentication tokens to the configuration
file including their scheme ("https://") but newer onces do not. Thus
in order to allow people to use the newer format (looking up auth for
a repo that isn't prefixed with scheme) with an older configuration file
we try prefixing the
serverAddress
with "https://" or "http://" in some cases.Fixes #804