From a7c0741fa7a3e6cbccedcbf85e689561cdfbb5f0 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 12 Aug 2026 16:38:26 +0200 Subject: [PATCH] cli/command/manifest: remove redundant normalization commit 55fcffe743c2ca097796d19492ee4f4c768c3940 added normalization in config/configfile, so it's no longer needed to normalize here as well. updates 55fcffe743c2ca097796d19492ee4f4c768c3940 Signed-off-by: Sebastiaan van Stijn --- cli/command/manifest/annotate.go | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/cli/command/manifest/annotate.go b/cli/command/manifest/annotate.go index 9bdb7b1d26cc..231aa930621f 100644 --- a/cli/command/manifest/annotate.go +++ b/cli/command/manifest/annotate.go @@ -48,27 +48,6 @@ func newManifestStore(dockerCLI command.Cli) store.Store { return store.NewStore(filepath.Join(config.Dir(), "manifests")) } -// authConfigKey is the key used to store credentials for Docker Hub. It is -// a copy of [registry.IndexServer]. -// -// [registry.IndexServer]: https://pkg.go.dev/github.com/docker/docker@v28.3.3+incompatible/registry#IndexServer -const authConfigKey = "https://index.docker.io/v1/" - -// getAuthConfigKey special-cases using the full index address of the official -// index as the AuthConfig key, and uses the (host)name[:port] for private indexes. -// -// It is similar to [registry.GetAuthConfigKey], but does not require on -// [registrytypes.IndexInfo] as intermediate. -// -// [registry.GetAuthConfigKey]: https://pkg.go.dev/github.com/docker/docker@v28.3.3+incompatible/registry#GetAuthConfigKey -// [registrytypes.IndexInfo]: https://pkg.go.dev/github.com/docker/docker@v28.3.3+incompatible/api/types/registry#IndexInfo -func getAuthConfigKey(domainName string) string { - if domainName == "docker.io" || domainName == "index.docker.io" { - return authConfigKey - } - return domainName -} - // newRegistryClient returns a client for communicating with a Docker distribution // registry func newRegistryClient(dockerCLI command.Cli, allowInsecure bool) registryclient.RegistryClient { @@ -78,8 +57,7 @@ func newRegistryClient(dockerCLI command.Cli, allowInsecure bool) registryclient } cfg := dockerCLI.ConfigFile() resolver := func(ctx context.Context, domainName string) registry.AuthConfig { - configKey := getAuthConfigKey(domainName) - a, _ := cfg.GetAuthConfig(configKey) + a, _ := cfg.GetAuthConfig(domainName) return registry.AuthConfig{ Username: a.Username, Password: a.Password,