Skip to content

Commit

Permalink
Fix login persistence regression against Hub
Browse files Browse the repository at this point in the history
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 <spam_blackhole@farcloser.world>
  • Loading branch information
apostasie committed Oct 2, 2024
1 parent c156ee6 commit 5cdb3e0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/imgutil/dockerconfigresolver/credentialsstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (cs *CredentialsStore) Store(registryURL *RegistryURL, credentials *Credent
if registryURL.Namespace != nil {
credentials.ServerAddress = fmt.Sprintf("%s%s?%s", registryURL.Host, registryURL.Path, registryURL.RawQuery)
} else {
credentials.ServerAddress = registryURL.Host
credentials.ServerAddress = registryURL.CanonicalIdentifier()
}

// XXX future namespaced url likely require special handling here
Expand Down
2 changes: 2 additions & 0 deletions pkg/imgutil/dockerconfigresolver/credentialsstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,3 +393,5 @@ func TestWorkingCredentialsStore(t *testing.T) {

})
}

// TODO: add more tests that write credentials (specifically to hub locations) to verify they use the canonical id properly
5 changes: 5 additions & 0 deletions pkg/imgutil/dockerconfigresolver/registryurl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ func TestURLParsingAndID(t *testing.T) {
address: "whatever://",
error: ErrUnsupportedScheme,
},
{
address: "",
identifier: "https://index.docker.io/v1/",
allIDs: []string{"https://index.docker.io/v1/"},
},
{
address: "https://index.docker.io/v1/",
identifier: "https://index.docker.io/v1/",
Expand Down

0 comments on commit 5cdb3e0

Please sign in to comment.