From e3da0cc584dc8c011d6303af4e5c442a97ee5319 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 1 Mar 2025 01:17:47 +0100 Subject: [PATCH] cli/registry/client: remove dependency on trust / notary The client was only using the Actions consts, but the trust package also has a dependency on notary. Remove the import to prevent Notary becoming a dependency for uses of the cli code. Signed-off-by: Sebastiaan van Stijn --- cli/registry/client/client.go | 5 ++--- cli/registry/client/endpoint.go | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cli/registry/client/client.go b/cli/registry/client/client.go index 6f15659bc6..c7f1a48082 100644 --- a/cli/registry/client/client.go +++ b/cli/registry/client/client.go @@ -8,7 +8,6 @@ import ( "github.com/distribution/reference" manifesttypes "github.com/docker/cli/cli/manifest/types" - "github.com/docker/cli/cli/trust" "github.com/docker/distribution" distributionclient "github.com/docker/distribution/registry/client" registrytypes "github.com/docker/docker/api/types/registry" @@ -78,7 +77,7 @@ func (c *client) MountBlob(ctx context.Context, sourceRef reference.Canonical, t if err != nil { return err } - repoEndpoint.actions = trust.ActionsPushAndPull + repoEndpoint.actions = []string{"pull", "push"} repo, err := c.getRepositoryForReference(ctx, targetRef, repoEndpoint) if err != nil { return err @@ -104,7 +103,7 @@ func (c *client) PutManifest(ctx context.Context, ref reference.Named, manifest return "", err } - repoEndpoint.actions = trust.ActionsPushAndPull + repoEndpoint.actions = []string{"pull", "push"} repo, err := c.getRepositoryForReference(ctx, ref, repoEndpoint) if err != nil { return "", err diff --git a/cli/registry/client/endpoint.go b/cli/registry/client/endpoint.go index 95312b0558..40abe31c20 100644 --- a/cli/registry/client/endpoint.go +++ b/cli/registry/client/endpoint.go @@ -6,7 +6,6 @@ import ( "time" "github.com/distribution/reference" - "github.com/docker/cli/cli/trust" "github.com/docker/distribution/registry/client/auth" "github.com/docker/distribution/registry/client/transport" registrytypes "github.com/docker/docker/api/types/registry" @@ -94,7 +93,7 @@ func getHTTPTransport(authConfig registrytypes.AuthConfig, endpoint registry.API modifiers = append(modifiers, auth.NewAuthorizer(challengeManager, passThruTokenHandler)) } else { if len(actions) == 0 { - actions = trust.ActionsPullOnly + actions = []string{"pull"} } creds := registry.NewStaticCredentialStore(&authConfig) tokenHandler := auth.NewTokenHandler(authTransport, creds, repoName, actions...)