cli/command: deprecate Cli.NotaryClient
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 in our code, which constructs the client in packages that need it, so we can deprecate this method. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
2793731977
commit
9bc16bbde0
@ -25,7 +25,6 @@ import (
|
|||||||
manifeststore "github.com/docker/cli/cli/manifest/store"
|
manifeststore "github.com/docker/cli/cli/manifest/store"
|
||||||
registryclient "github.com/docker/cli/cli/registry/client"
|
registryclient "github.com/docker/cli/cli/registry/client"
|
||||||
"github.com/docker/cli/cli/streams"
|
"github.com/docker/cli/cli/streams"
|
||||||
"github.com/docker/cli/cli/trust"
|
|
||||||
"github.com/docker/cli/cli/version"
|
"github.com/docker/cli/cli/version"
|
||||||
dopts "github.com/docker/cli/opts"
|
dopts "github.com/docker/cli/opts"
|
||||||
"github.com/docker/docker/api"
|
"github.com/docker/docker/api"
|
||||||
@ -36,7 +35,6 @@ import (
|
|||||||
"github.com/docker/go-connections/tlsconfig"
|
"github.com/docker/go-connections/tlsconfig"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
notaryclient "github.com/theupdateframework/notary/client"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultInitTimeout = 2 * time.Second
|
const defaultInitTimeout = 2 * time.Second
|
||||||
@ -56,7 +54,6 @@ type Cli interface {
|
|||||||
Apply(ops ...CLIOption) error
|
Apply(ops ...CLIOption) error
|
||||||
ConfigFile() *configfile.ConfigFile
|
ConfigFile() *configfile.ConfigFile
|
||||||
ServerInfo() ServerInfo
|
ServerInfo() ServerInfo
|
||||||
NotaryClient(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error)
|
|
||||||
DefaultVersion() string
|
DefaultVersion() string
|
||||||
CurrentVersion() string
|
CurrentVersion() string
|
||||||
ManifestStore() manifeststore.Store
|
ManifestStore() manifeststore.Store
|
||||||
@ -67,6 +64,7 @@ type Cli interface {
|
|||||||
CurrentContext() string
|
CurrentContext() string
|
||||||
DockerEndpoint() docker.Endpoint
|
DockerEndpoint() docker.Endpoint
|
||||||
TelemetryClient
|
TelemetryClient
|
||||||
|
DeprecatedNotaryClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// DockerCli is an instance the docker command line client.
|
// DockerCli is an instance the docker command line client.
|
||||||
@ -405,11 +403,6 @@ func (cli *DockerCli) initializeFromClient() {
|
|||||||
cli.client.NegotiateAPIVersionPing(ping)
|
cli.client.NegotiateAPIVersionPing(ping)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ContextStore returns the ContextStore
|
// ContextStore returns the ContextStore
|
||||||
func (cli *DockerCli) ContextStore() store.Store {
|
func (cli *DockerCli) ContextStore() store.Store {
|
||||||
return cli.contextStore
|
return cli.contextStore
|
||||||
|
18
cli/command/cli_deprecated.go
Normal file
18
cli/command/cli_deprecated.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/docker/cli/cli/trust"
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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...)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user