Skip to content

Commit 5cdb3e0

Browse files
committed
Fix login persistence regression against Hub
Login no longer persists for Docker Hub, as a mistake in the code was not using the special case Docker Hub key to save in the store. Signed-off-by: apostasie <[email protected]>
1 parent c156ee6 commit 5cdb3e0

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

pkg/imgutil/dockerconfigresolver/credentialsstore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (cs *CredentialsStore) Store(registryURL *RegistryURL, credentials *Credent
8383
if registryURL.Namespace != nil {
8484
credentials.ServerAddress = fmt.Sprintf("%s%s?%s", registryURL.Host, registryURL.Path, registryURL.RawQuery)
8585
} else {
86-
credentials.ServerAddress = registryURL.Host
86+
credentials.ServerAddress = registryURL.CanonicalIdentifier()
8787
}
8888

8989
// XXX future namespaced url likely require special handling here

pkg/imgutil/dockerconfigresolver/credentialsstore_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,3 +393,5 @@ func TestWorkingCredentialsStore(t *testing.T) {
393393

394394
})
395395
}
396+
397+
// TODO: add more tests that write credentials (specifically to hub locations) to verify they use the canonical id properly

pkg/imgutil/dockerconfigresolver/registryurl_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ func TestURLParsingAndID(t *testing.T) {
3838
address: "whatever://",
3939
error: ErrUnsupportedScheme,
4040
},
41+
{
42+
address: "",
43+
identifier: "https://index.docker.io/v1/",
44+
allIDs: []string{"https://index.docker.io/v1/"},
45+
},
4146
{
4247
address: "https://index.docker.io/v1/",
4348
identifier: "https://index.docker.io/v1/",

0 commit comments

Comments
 (0)