From e83d6cd2c8a4fb29acde76a0f46b5c11e1f906dd Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 26 Feb 2022 10:57:30 +0100 Subject: [PATCH] cli/registry/client: remove unused GetRegistryAuth() This was added in fd2f1b3b6650b53ed1367b84910e0f81e89220cd as part of the `docker engine` sub-commands, which were deprecated, and removed in 43b2f52d0ca4b57bddd0fd541d8440e1f17fd0a6. This function is not used by anyone, so safe to remove. Signed-off-by: Sebastiaan van Stijn --- cli/registry/client/client.go | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/cli/registry/client/client.go b/cli/registry/client/client.go index 3ed139840d..4c411b9da6 100644 --- a/cli/registry/client/client.go +++ b/cli/registry/client/client.go @@ -7,7 +7,6 @@ import ( "strings" manifesttypes "github.com/docker/cli/cli/manifest/types" - "github.com/docker/cli/cli/trust" "github.com/docker/distribution" "github.com/docker/distribution/reference" distributionclient "github.com/docker/distribution/registry/client" @@ -207,16 +206,3 @@ func getManifestOptionsFromReference(ref reference.Named) (digest.Digest, []dist } return "", nil, errors.Errorf("%s no tag or digest", ref) } - -// GetRegistryAuth returns the auth config given an input image -func GetRegistryAuth(ctx context.Context, resolver AuthConfigResolver, imageName string) (*types.AuthConfig, error) { - distributionRef, err := reference.ParseNormalizedNamed(imageName) - if err != nil { - return nil, fmt.Errorf("Failed to parse image name: %s: %s", imageName, err) - } - imgRefAndAuth, err := trust.GetImageReferencesAndAuth(ctx, nil, resolver, distributionRef.String()) - if err != nil { - return nil, fmt.Errorf("Failed to get imgRefAndAuth: %s", err) - } - return imgRefAndAuth.AuthConfig(), nil -}