From 66eb27a487e02800278e43ac0ce8f6f7249c0a9c Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 1 Mar 2025 01:34:23 +0100 Subject: [PATCH 1/6] cli/command: remove deprecated NotaryClient from CLI interface This method is a shallow wrapper around trust.GetNotaryRepository, but due to its signature resulted in the trust package, and notary dependencies to become a dependency of the CLI. Consequence of this was that cli-plugins, which need the cli/command package, would also get notary and its dependencies as a dependency. It is no longer used, and was deprecated in 9bc16bbde085c618d3bddfb633560ab9af83a58d. This patch removes the NotaryClient method from the interface Signed-off-by: Sebastiaan van Stijn --- cli/command/cli.go | 1 - cli/command/cli_deprecated.go | 14 -------------- 2 files changed, 15 deletions(-) diff --git a/cli/command/cli.go b/cli/command/cli.go index 8b5780d6b751..fb3fb5793495 100644 --- a/cli/command/cli.go +++ b/cli/command/cli.go @@ -56,7 +56,6 @@ type Cli interface { CurrentContext() string DockerEndpoint() docker.Endpoint TelemetryClient - DeprecatedNotaryClient DeprecatedManifestClient } diff --git a/cli/command/cli_deprecated.go b/cli/command/cli_deprecated.go index 15fac1a6e327..90137f22202c 100644 --- a/cli/command/cli_deprecated.go +++ b/cli/command/cli_deprecated.go @@ -7,18 +7,9 @@ import ( "github.com/docker/cli/cli/config" manifeststore "github.com/docker/cli/cli/manifest/store" registryclient "github.com/docker/cli/cli/registry/client" - "github.com/docker/cli/cli/trust" "github.com/docker/docker/api/types/registry" - notaryclient "github.com/theupdateframework/notary/client" ) -type DeprecatedNotaryClient interface { - // NotaryClient provides a Notary Repository to interact with signed metadata for an image - // - // Deprecated: use [trust.GetNotaryRepository] instead. This method is no longer used and will be removed in the next release. - NotaryClient(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error) -} - type DeprecatedManifestClient interface { // ManifestStore returns a store for local manifests // @@ -32,11 +23,6 @@ type DeprecatedManifestClient interface { RegistryClient(bool) registryclient.RegistryClient } -// NotaryClient provides a Notary Repository to interact with signed metadata for an image -func (cli *DockerCli) NotaryClient(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error) { - return trust.GetNotaryRepository(cli.In(), cli.Out(), UserAgent(), imgRefAndAuth.RepoInfo(), imgRefAndAuth.AuthConfig(), actions...) -} - // ManifestStore returns a store for local manifests // // Deprecated: use [manifeststore.NewStore] instead. This method is no longer used and will be removed in the next release. From 08f86507b42642d9782ddf7abf8d1f1d1507254b Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 1 Mar 2025 02:33:48 +0100 Subject: [PATCH 2/6] cli/command: remove deprecated ManifestStore from CLI interface This method is a shallow wrapper around manifeststore.NewStore, but due to its signature resulted in various dependencies becoming a dependency of the "command" package. Consequence of this was that cli-plugins, which need the cli/command package, would also get those dependencies. It is no longer used, and was deprecated in e32d5d56f5fea7cdfb91a317d517cd163c4954d7. This patch removes the ManifestStore method from the interface Signed-off-by: Sebastiaan van Stijn --- cli/command/cli_deprecated.go | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/cli/command/cli_deprecated.go b/cli/command/cli_deprecated.go index 90137f22202c..9b052db5d42f 100644 --- a/cli/command/cli_deprecated.go +++ b/cli/command/cli_deprecated.go @@ -2,20 +2,12 @@ package command import ( "context" - "path/filepath" - "github.com/docker/cli/cli/config" - manifeststore "github.com/docker/cli/cli/manifest/store" registryclient "github.com/docker/cli/cli/registry/client" "github.com/docker/docker/api/types/registry" ) type DeprecatedManifestClient interface { - // ManifestStore returns a store for local manifests - // - // Deprecated: use [manifeststore.NewStore] instead. This method is no longer used and will be removed in the next release. - ManifestStore() manifeststore.Store - // RegistryClient returns a client for communicating with a Docker distribution // registry. // @@ -23,13 +15,6 @@ type DeprecatedManifestClient interface { RegistryClient(bool) registryclient.RegistryClient } -// ManifestStore returns a store for local manifests -// -// Deprecated: use [manifeststore.NewStore] instead. This method is no longer used and will be removed in the next release. -func (*DockerCli) ManifestStore() manifeststore.Store { - return manifeststore.NewStore(filepath.Join(config.Dir(), "manifests")) -} - // RegistryClient returns a client for communicating with a Docker distribution // registry // From 5ea072d9369b933adeecb701ef60319e76bf9a02 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 1 Mar 2025 02:45:42 +0100 Subject: [PATCH 3/6] cli/command: remove deprecated RegistryClient from CLI interface This method was a shallow wrapper around registryclient.NewRegistryClient but due to its signature resulted in various dependencies becoming a dependency of the "command" package. Consequence of this was that cli-plugins, which need the cli/command package, would also get those dependencies. It is no longer used, and was deprecated in 8ad07217dc92fa81806d4eb64a4eb04cf5c99b15. This patch removes the RegistryClient method from the interface Signed-off-by: Sebastiaan van Stijn --- cli/command/cli.go | 1 - cli/command/cli_deprecated.go | 27 --------------------------- 2 files changed, 28 deletions(-) delete mode 100644 cli/command/cli_deprecated.go diff --git a/cli/command/cli.go b/cli/command/cli.go index fb3fb5793495..2a78c5079cb2 100644 --- a/cli/command/cli.go +++ b/cli/command/cli.go @@ -56,7 +56,6 @@ type Cli interface { CurrentContext() string DockerEndpoint() docker.Endpoint TelemetryClient - DeprecatedManifestClient } // DockerCli is an instance the docker command line client. diff --git a/cli/command/cli_deprecated.go b/cli/command/cli_deprecated.go deleted file mode 100644 index 9b052db5d42f..000000000000 --- a/cli/command/cli_deprecated.go +++ /dev/null @@ -1,27 +0,0 @@ -package command - -import ( - "context" - - registryclient "github.com/docker/cli/cli/registry/client" - "github.com/docker/docker/api/types/registry" -) - -type DeprecatedManifestClient interface { - // RegistryClient returns a client for communicating with a Docker distribution - // registry. - // - // Deprecated: use [registryclient.NewRegistryClient]. This method is no longer used and will be removed in the next release. - RegistryClient(bool) registryclient.RegistryClient -} - -// RegistryClient returns a client for communicating with a Docker distribution -// registry -// -// Deprecated: use [registryclient.NewRegistryClient]. This method is no longer used and will be removed in the next release. -func (cli *DockerCli) RegistryClient(allowInsecure bool) registryclient.RegistryClient { - resolver := func(ctx context.Context, index *registry.IndexInfo) registry.AuthConfig { - return ResolveAuthConfig(cli.ConfigFile(), index) - } - return registryclient.NewRegistryClient(resolver, UserAgent(), allowInsecure) -} From 98d0b0cc142a53fb30c561d340b7ea245a33ce08 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 5 Mar 2025 18:21:49 +0100 Subject: [PATCH 4/6] cli/command/image: remove deprecated TrustedPush This function was only used by "docker trust sign", and has no known external consumers. It was deprecated in c6f456bc90574f4180f3b990e8a4e216485e35b7; this commit removes it. Signed-off-by: Sebastiaan van Stijn --- cli/command/image/trust.go | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/cli/command/image/trust.go b/cli/command/image/trust.go index b4a6d84a0093..21f9cf8c1d97 100644 --- a/cli/command/image/trust.go +++ b/cli/command/image/trust.go @@ -41,20 +41,6 @@ func newNotaryClient(cli command.Streams, imgRefAndAuth trust.ImageRefAndAuth) ( return trust.GetNotaryRepository(cli.In(), cli.Out(), command.UserAgent(), imgRefAndAuth.RepoInfo(), imgRefAndAuth.AuthConfig(), "pull") } -// TrustedPush handles content trust pushing of an image. -// -// Deprecated: this function was only used internally and will be removed in the next release. -func TrustedPush(ctx context.Context, cli command.Cli, repoInfo *registry.RepositoryInfo, ref reference.Named, authConfig registrytypes.AuthConfig, options image.PushOptions) error { - responseBody, err := cli.Client().ImagePush(ctx, reference.FamiliarString(ref), options) - if err != nil { - return err - } - - defer responseBody.Close() - - return trust.PushTrustedReference(ctx, cli, repoInfo, ref, authConfig, responseBody, command.UserAgent()) -} - // PushTrustedReference pushes a canonical reference to the trust server. // // Deprecated: use [trust.PushTrustedReference] instead. this function was only used internally and will be removed in the next release. From eaf98b2202e6a487fec0942150ece58d9cc43cc1 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 5 Mar 2025 18:22:22 +0100 Subject: [PATCH 5/6] cli/command/image: remove deprecated PushTrustedReference This function was only used internally, and has no known external consumers. It was deprecated in d80436021c21c26b492f0014511f13f41d8b42d9; this commit removes it. Signed-off-by: Sebastiaan van Stijn --- cli/command/image/trust.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cli/command/image/trust.go b/cli/command/image/trust.go index 21f9cf8c1d97..62517545208e 100644 --- a/cli/command/image/trust.go +++ b/cli/command/image/trust.go @@ -41,13 +41,6 @@ func newNotaryClient(cli command.Streams, imgRefAndAuth trust.ImageRefAndAuth) ( return trust.GetNotaryRepository(cli.In(), cli.Out(), command.UserAgent(), imgRefAndAuth.RepoInfo(), imgRefAndAuth.AuthConfig(), "pull") } -// PushTrustedReference pushes a canonical reference to the trust server. -// -// Deprecated: use [trust.PushTrustedReference] instead. this function was only used internally and will be removed in the next release. -func PushTrustedReference(ctx context.Context, ioStreams command.Streams, repoInfo *registry.RepositoryInfo, ref reference.Named, authConfig registrytypes.AuthConfig, in io.Reader) error { - return pushTrustedReference(ctx, ioStreams, repoInfo, ref, authConfig, in) -} - // pushTrustedReference pushes a canonical reference to the trust server. func pushTrustedReference(ctx context.Context, ioStreams command.Streams, repoInfo *registry.RepositoryInfo, ref reference.Named, authConfig registrytypes.AuthConfig, in io.Reader) error { return trust.PushTrustedReference(ctx, ioStreams, repoInfo, ref, authConfig, in, command.UserAgent()) From 4541df21e5ca3869b0fec60d875498fcd1629fbc Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 5 Mar 2025 18:22:51 +0100 Subject: [PATCH 6/6] cli/command/image: remove deprecated TagTrusted This function was only used internally, and has no known external consumers. It was deprecated in e37d814ce96b01393a400c081666ea1cca2eb8bd; this commit removes it. Signed-off-by: Sebastiaan van Stijn --- cli/command/image/trust.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/cli/command/image/trust.go b/cli/command/image/trust.go index 62517545208e..7e2e46b2eec0 100644 --- a/cli/command/image/trust.go +++ b/cli/command/image/trust.go @@ -208,15 +208,6 @@ func convertTarget(t client.Target) (target, error) { }, nil } -// TagTrusted tags a trusted ref. It is a shallow wrapper around APIClient.ImageTag -// that updates the given image references to their familiar format for tagging -// and printing. -// -// Deprecated: this function was only used internally, and will be removed in the next release. -func TagTrusted(ctx context.Context, cli command.Cli, trustedRef reference.Canonical, ref reference.NamedTagged) error { - return trust.TagTrusted(ctx, cli.Client(), cli.Err(), trustedRef, ref) -} - // AuthResolver returns an auth resolver function from a command.Cli func AuthResolver(cli command.Cli) func(ctx context.Context, index *registrytypes.IndexInfo) registrytypes.AuthConfig { return func(ctx context.Context, index *registrytypes.IndexInfo) registrytypes.AuthConfig {