diff --git a/driver/kubernetes/context/load_test.go b/driver/kubernetes/context/load_test.go index b6953c97f6b6..d1a1beed35c5 100644 --- a/driver/kubernetes/context/load_test.go +++ b/driver/kubernetes/context/load_test.go @@ -5,18 +5,15 @@ import ( "testing" "github.com/docker/cli/cli/command" - "github.com/docker/cli/cli/config/configfile" cliflags "github.com/docker/cli/cli/flags" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestDefaultContextInitializer(t *testing.T) { - cli, err := command.NewDockerCli() - require.NoError(t, err) os.Setenv("KUBECONFIG", "./fixtures/test-kubeconfig") defer os.Unsetenv("KUBECONFIG") - ctx, err := command.ResolveDefaultContext(&cliflags.CommonOptions{}, &configfile.ConfigFile{}, command.DefaultContextStoreConfig(), cli.Err()) + ctx, err := command.ResolveDefaultContext(&cliflags.CommonOptions{}, command.DefaultContextStoreConfig()) require.NoError(t, err) assert.Equal(t, "default", ctx.Meta.Name) assert.Equal(t, "zoinx", ctx.Meta.Endpoints[KubernetesEndpoint].(EndpointMeta).DefaultNamespace) diff --git a/go.mod b/go.mod index 5b3b7d656bde..4a97a158866c 100644 --- a/go.mod +++ b/go.mod @@ -148,7 +148,7 @@ require ( ) replace ( - github.com/docker/cli => github.com/docker/cli v20.10.3-0.20220721163225-f1615facb1ca+incompatible // master (v22.06-dev) + github.com/docker/cli => github.com/docker/cli v20.10.3-0.20220729124628-e198123693b1+incompatible // master (v22.06-dev) github.com/docker/docker => github.com/docker/docker v20.10.3-0.20220720171342-a60b458179aa+incompatible // 22.06 branch (v22.06-dev) k8s.io/api => k8s.io/api v0.22.4 k8s.io/apimachinery => k8s.io/apimachinery v0.22.4 diff --git a/go.sum b/go.sum index ab8f77a30831..46335ae9d515 100644 --- a/go.sum +++ b/go.sum @@ -161,8 +161,8 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8 github.com/distribution/distribution/v3 v3.0.0-20210316161203-a01c71e2477e h1:n81KvOMrLZa+VWHwST7dun9f0G98X3zREHS1ztYzZKU= github.com/distribution/distribution/v3 v3.0.0-20210316161203-a01c71e2477e/go.mod h1:xpWTC2KnJMiDLkoawhsPQcXjvwATEBcbq0xevG2YR9M= github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= -github.com/docker/cli v20.10.3-0.20220721163225-f1615facb1ca+incompatible h1:Dd/CSOpM6U0thw3xNPlw6m+5/4VOexEcgKlL38haGgk= -github.com/docker/cli v20.10.3-0.20220721163225-f1615facb1ca+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v20.10.3-0.20220729124628-e198123693b1+incompatible h1:eCc22fv71RsA+aqrmNXiVH5G57U75UmvK9O+Ur+A2A8= +github.com/docker/cli v20.10.3-0.20220729124628-e198123693b1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/cli-docs-tool v0.5.0 h1:EjGwI6EyB7YemHCC7R8mwXszJTbuq0T0pFuDC5bMhcE= github.com/docker/cli-docs-tool v0.5.0/go.mod h1:zMjqTFCU361PRh8apiXzeAZ1Q/xupbIwTusYpzCXS/o= github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= diff --git a/vendor/github.com/docker/cli/cli/command/cli.go b/vendor/github.com/docker/cli/cli/command/cli.go index 2e4c0b55a67f..afa7cd338704 100644 --- a/vendor/github.com/docker/cli/cli/command/cli.go +++ b/vendor/github.com/docker/cli/cli/command/cli.go @@ -216,7 +216,7 @@ func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions, ops ...Initialize cli.contextStore = &ContextStoreWithDefault{ Store: baseContextStore, Resolver: func() (*DefaultContext, error) { - return ResolveDefaultContext(opts.Common, cli.ConfigFile(), cli.contextStoreConfig, cli.Err()) + return ResolveDefaultContext(opts.Common, cli.contextStoreConfig) }, } cli.currentContext, err = resolveContextName(opts.Common, cli.configFile, cli.contextStore) @@ -244,7 +244,7 @@ func NewAPIClientFromFlags(opts *cliflags.CommonOptions, configFile *configfile. contextStore := &ContextStoreWithDefault{ Store: store.New(config.ContextStoreDir(), storeConfig), Resolver: func() (*DefaultContext, error) { - return ResolveDefaultContext(opts, configFile, storeConfig, io.Discard) + return ResolveDefaultContext(opts, storeConfig) }, } contextName, err := resolveContextName(opts, configFile, contextStore) @@ -456,10 +456,10 @@ func resolveContextName(opts *cliflags.CommonOptions, config *configfile.ConfigF if len(opts.Hosts) > 0 { return DefaultContextName, nil } - if _, present := os.LookupEnv(client.EnvOverrideHost); present { + if os.Getenv(client.EnvOverrideHost) != "" { return DefaultContextName, nil } - if ctxName, ok := os.LookupEnv("DOCKER_CONTEXT"); ok { + if ctxName := os.Getenv("DOCKER_CONTEXT"); ctxName != "" { return ctxName, nil } if config != nil && config.CurrentContext != "" { diff --git a/vendor/github.com/docker/cli/cli/command/cli_options.go b/vendor/github.com/docker/cli/cli/command/cli_options.go index cd8179498201..535a6d5338d4 100644 --- a/vendor/github.com/docker/cli/cli/command/cli_options.go +++ b/vendor/github.com/docker/cli/cli/command/cli_options.go @@ -1,13 +1,10 @@ package command import ( - "fmt" "io" "os" "strconv" - "github.com/docker/cli/cli/context/docker" - "github.com/docker/cli/cli/context/store" "github.com/docker/cli/cli/streams" "github.com/moby/term" ) @@ -82,19 +79,6 @@ func WithContentTrust(enabled bool) DockerCliOption { } } -// WithContextEndpointType add support for an additional typed endpoint in the context store -// Plugins should use this to store additional endpoints configuration in the context store -func WithContextEndpointType(endpointName string, endpointType store.TypeGetter) DockerCliOption { - return func(cli *DockerCli) error { - switch endpointName { - case docker.DockerEndpoint: - return fmt.Errorf("cannot change %q endpoint type", endpointName) - } - cli.contextStoreConfig.SetEndpoint(endpointName, endpointType) - return nil - } -} - // WithDefaultContextStoreConfig configures the cli to use the default context store configuration. func WithDefaultContextStoreConfig() DockerCliOption { return func(cli *DockerCli) error { diff --git a/vendor/github.com/docker/cli/cli/command/defaultcontextstore.go b/vendor/github.com/docker/cli/cli/command/defaultcontextstore.go index 4f8e2ef52360..a0dd1b18653b 100644 --- a/vendor/github.com/docker/cli/cli/command/defaultcontextstore.go +++ b/vendor/github.com/docker/cli/cli/command/defaultcontextstore.go @@ -2,9 +2,7 @@ package command import ( "fmt" - "io" - "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/cli/context/docker" "github.com/docker/cli/cli/context/store" cliflags "github.com/docker/cli/cli/flags" @@ -45,7 +43,7 @@ type EndpointDefaultResolver interface { } // ResolveDefaultContext creates a Metadata for the current CLI invocation parameters -func ResolveDefaultContext(opts *cliflags.CommonOptions, config *configfile.ConfigFile, storeconfig store.Config, stderr io.Writer) (*DefaultContext, error) { +func ResolveDefaultContext(opts *cliflags.CommonOptions, config store.Config) (*DefaultContext, error) { contextTLSData := store.ContextTLSData{ Endpoints: make(map[string]store.EndpointTLSData), } @@ -66,7 +64,7 @@ func ResolveDefaultContext(opts *cliflags.CommonOptions, config *configfile.Conf contextTLSData.Endpoints[docker.DockerEndpoint] = *dockerEP.TLSData.ToStoreTLSData() } - if err := storeconfig.ForeachEndpointType(func(n string, get store.TypeGetter) error { + if err := config.ForeachEndpointType(func(n string, get store.TypeGetter) error { if n == docker.DockerEndpoint { // handled above return nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 969f6c9cb1be..cbe681a49049 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -98,7 +98,7 @@ github.com/davecgh/go-spew/spew ## explicit; go 1.15 github.com/distribution/distribution/v3/digestset github.com/distribution/distribution/v3/reference -# github.com/docker/cli v20.10.17+incompatible => github.com/docker/cli v20.10.3-0.20220721163225-f1615facb1ca+incompatible +# github.com/docker/cli v20.10.17+incompatible => github.com/docker/cli v20.10.3-0.20220729124628-e198123693b1+incompatible ## explicit github.com/docker/cli/cli github.com/docker/cli/cli-plugins/manager @@ -985,7 +985,7 @@ sigs.k8s.io/structured-merge-diff/v4/value # sigs.k8s.io/yaml v1.2.0 ## explicit; go 1.12 sigs.k8s.io/yaml -# github.com/docker/cli => github.com/docker/cli v20.10.3-0.20220721163225-f1615facb1ca+incompatible +# github.com/docker/cli => github.com/docker/cli v20.10.3-0.20220729124628-e198123693b1+incompatible # github.com/docker/docker => github.com/docker/docker v20.10.3-0.20220720171342-a60b458179aa+incompatible # k8s.io/api => k8s.io/api v0.22.4 # k8s.io/apimachinery => k8s.io/apimachinery v0.22.4