From 89f38282fdc2c1018a98741080cc5949942bec9d Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 19 May 2025 22:40:55 +0200 Subject: [PATCH 1/2] vendor: github.com/docker/docker v28.2.0-rc.1 no diff: same commit, but tagged full diff: https://github.com/docker/docker/compare/7937f0846c13...v28.2.0-rc.1 Signed-off-by: Sebastiaan van Stijn --- vendor.mod | 2 +- vendor.sum | 4 ++-- vendor/modules.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vendor.mod b/vendor.mod index 46273738ec..2f070632bf 100644 --- a/vendor.mod +++ b/vendor.mod @@ -15,7 +15,7 @@ require ( github.com/distribution/reference v0.6.0 github.com/docker/cli-docs-tool v0.9.0 github.com/docker/distribution v2.8.3+incompatible - github.com/docker/docker v28.1.2-0.20250519114040-7937f0846c13+incompatible // master, v28.x dev + github.com/docker/docker v28.2.0-rc.1+incompatible github.com/docker/docker-credential-helpers v0.9.3 github.com/docker/go-connections v0.5.0 github.com/docker/go-units v0.5.0 diff --git a/vendor.sum b/vendor.sum index 3d2bac65cb..c73b4124ab 100644 --- a/vendor.sum +++ b/vendor.sum @@ -55,8 +55,8 @@ github.com/docker/cli-docs-tool v0.9.0/go.mod h1:ClrwlNW+UioiRyH9GiAOe1o3J/TsY3T github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v28.1.2-0.20250519114040-7937f0846c13+incompatible h1:hQ0dI0strJB2gjh/Sx+WthVEhOe89DPjAwiZVwjbpIg= -github.com/docker/docker v28.1.2-0.20250519114040-7937f0846c13+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v28.2.0-rc.1+incompatible h1:wkPZ0yYhwfXHxnIXOXwgOsBVSwTUUbQ3nBYGC7L6sl8= +github.com/docker/docker v28.2.0-rc.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.9.3 h1:gAm/VtF9wgqJMoxzT3Gj5p4AqIjCBS4wrsOh9yRqcz8= github.com/docker/docker-credential-helpers v0.9.3/go.mod h1:x+4Gbw9aGmChi3qTLZj8Dfn0TD20M/fuWy0E5+WDeCo= github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0= diff --git a/vendor/modules.txt b/vendor/modules.txt index 27ac6d9d80..d0dd180357 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -61,7 +61,7 @@ github.com/docker/distribution/registry/client/transport github.com/docker/distribution/registry/storage/cache github.com/docker/distribution/registry/storage/cache/memory github.com/docker/distribution/uuid -# github.com/docker/docker v28.1.2-0.20250519114040-7937f0846c13+incompatible +# github.com/docker/docker v28.2.0-rc.1+incompatible ## explicit github.com/docker/docker/api github.com/docker/docker/api/types From ed5d9757c9bd8d4d952f1f631308f28c06355470 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 19 May 2025 17:03:39 +0200 Subject: [PATCH 2/2] vendor: github.com/docker/docker 8601b22f5db5 (v28.2-dev) full diff: https://github.com/docker/docker/compare/v28.2.0-rc.1...8601b22f5db511354d643a7722d11d33aa7ae13f Signed-off-by: Sebastiaan van Stijn --- cli/command/idresolver/client_test.go | 3 +- cli/command/idresolver/idresolver.go | 3 +- cli/command/node/client_test.go | 13 ++- cli/command/node/cmd.go | 4 +- cli/command/node/completion.go | 4 +- cli/command/node/list.go | 4 +- cli/command/node/ps.go | 3 +- cli/command/node/ps_test.go | 17 ++-- cli/command/node/remove.go | 4 +- cli/command/service/client_test.go | 21 +++-- cli/command/service/completion.go | 4 +- cli/command/service/create.go | 3 +- cli/command/service/inspect.go | 4 +- cli/command/service/list.go | 7 +- cli/command/service/list_test.go | 9 +- cli/command/service/logs.go | 3 +- cli/command/service/progress/progress.go | 7 +- cli/command/service/ps.go | 8 +- cli/command/service/ps_test.go | 11 ++- cli/command/service/rollback.go | 6 +- cli/command/service/rollback_test.go | 13 ++- cli/command/service/scale.go | 6 +- cli/command/service/update.go | 9 +- cli/command/stack/client_test.go | 18 ++-- cli/command/stack/list_test.go | 9 +- cli/command/stack/ps_test.go | 21 +++-- cli/command/stack/services_test.go | 31 ++++--- cli/command/stack/swarm/client_test.go | 16 ++-- cli/command/stack/swarm/common.go | 5 +- cli/command/stack/swarm/deploy_composefile.go | 5 +- cli/command/stack/swarm/deploy_test.go | 9 +- cli/command/stack/swarm/list.go | 4 +- cli/command/stack/swarm/ps.go | 4 +- cli/command/stack/swarm/services.go | 3 +- cli/command/swarm/client_test.go | 7 +- cli/command/swarm/init_test.go | 13 ++- cli/command/swarm/progress/root_rotation.go | 3 +- cli/command/swarm/unlock_key_test.go | 31 +++---- cli/command/swarm/update_test.go | 13 ++- cli/command/system/client_test.go | 4 +- cli/command/system/completion.go | 4 +- cli/command/system/completion_test.go | 5 +- cli/command/system/inspect.go | 4 +- cli/command/task/client_test.go | 5 +- cli/command/task/print_test.go | 7 +- vendor.mod | 2 +- vendor.sum | 4 +- .../docker/docker/api/types/client.go | 90 ------------------- .../docker/docker/api/types/swarm/node.go | 11 +++ .../docker/docker/api/types/swarm/service.go | 72 ++++++++++++++- .../docker/docker/api/types/swarm/swarm.go | 7 ++ .../docker/docker/api/types/swarm/task.go | 6 ++ .../docker/api/types/types_deprecated.go | 47 ++++++++++ .../docker/docker/client/client_interfaces.go | 16 ++-- .../docker/docker/client/image_pull.go | 4 +- .../docker/docker/client/image_push.go | 4 +- .../docker/docker/client/image_search.go | 4 +- .../docker/docker/client/node_list.go | 3 +- .../docker/docker/client/node_remove.go | 4 +- .../docker/docker/client/plugin_install.go | 4 +- .../docker/docker/client/request.go | 6 +- .../docker/docker/client/service_create.go | 3 +- .../docker/docker/client/service_inspect.go | 3 +- .../docker/docker/client/service_list.go | 3 +- .../docker/docker/client/service_update.go | 3 +- .../docker/client/swarm_get_unlock_key.go | 8 +- .../docker/docker/client/task_list.go | 3 +- .../github.com/docker/docker/client/utils.go | 4 +- vendor/modules.txt | 2 +- 69 files changed, 356 insertions(+), 344 deletions(-) diff --git a/cli/command/idresolver/client_test.go b/cli/command/idresolver/client_test.go index 62049f4257..569022f642 100644 --- a/cli/command/idresolver/client_test.go +++ b/cli/command/idresolver/client_test.go @@ -3,7 +3,6 @@ package idresolver import ( "context" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" ) @@ -21,7 +20,7 @@ func (cli *fakeClient) NodeInspectWithRaw(_ context.Context, nodeID string) (swa return swarm.Node{}, []byte{}, nil } -func (cli *fakeClient) ServiceInspectWithRaw(_ context.Context, serviceID string, _ types.ServiceInspectOptions) (swarm.Service, []byte, error) { +func (cli *fakeClient) ServiceInspectWithRaw(_ context.Context, serviceID string, _ swarm.ServiceInspectOptions) (swarm.Service, []byte, error) { if cli.serviceInspectFunc != nil { return cli.serviceInspectFunc(serviceID) } diff --git a/cli/command/idresolver/idresolver.go b/cli/command/idresolver/idresolver.go index 2dcad90e05..143139022d 100644 --- a/cli/command/idresolver/idresolver.go +++ b/cli/command/idresolver/idresolver.go @@ -6,7 +6,6 @@ package idresolver import ( "context" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" "github.com/pkg/errors" @@ -44,7 +43,7 @@ func (r *IDResolver) get(ctx context.Context, t any, id string) (string, error) } return id, nil case swarm.Service: - service, _, err := r.client.ServiceInspectWithRaw(ctx, id, types.ServiceInspectOptions{}) + service, _, err := r.client.ServiceInspectWithRaw(ctx, id, swarm.ServiceInspectOptions{}) if err != nil { // TODO(thaJeztah): should error-handling be more specific, or is it ok to ignore any error? return id, nil //nolint:nilerr // ignore nil-error being returned, as this is a best-effort. diff --git a/cli/command/node/client_test.go b/cli/command/node/client_test.go index 505d07259b..88c2390cae 100644 --- a/cli/command/node/client_test.go +++ b/cli/command/node/client_test.go @@ -3,7 +3,6 @@ package node import ( "context" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/system" "github.com/docker/docker/client" @@ -17,8 +16,8 @@ type fakeClient struct { nodeRemoveFunc func() error nodeUpdateFunc func(nodeID string, version swarm.Version, node swarm.NodeSpec) error taskInspectFunc func(taskID string) (swarm.Task, []byte, error) - taskListFunc func(options types.TaskListOptions) ([]swarm.Task, error) - serviceInspectFunc func(ctx context.Context, serviceID string, opts types.ServiceInspectOptions) (swarm.Service, []byte, error) + taskListFunc func(options swarm.TaskListOptions) ([]swarm.Task, error) + serviceInspectFunc func(ctx context.Context, serviceID string, opts swarm.ServiceInspectOptions) (swarm.Service, []byte, error) } func (cli *fakeClient) NodeInspectWithRaw(context.Context, string) (swarm.Node, []byte, error) { @@ -28,14 +27,14 @@ func (cli *fakeClient) NodeInspectWithRaw(context.Context, string) (swarm.Node, return swarm.Node{}, []byte{}, nil } -func (cli *fakeClient) NodeList(context.Context, types.NodeListOptions) ([]swarm.Node, error) { +func (cli *fakeClient) NodeList(context.Context, swarm.NodeListOptions) ([]swarm.Node, error) { if cli.nodeListFunc != nil { return cli.nodeListFunc() } return []swarm.Node{}, nil } -func (cli *fakeClient) NodeRemove(context.Context, string, types.NodeRemoveOptions) error { +func (cli *fakeClient) NodeRemove(context.Context, string, swarm.NodeRemoveOptions) error { if cli.nodeRemoveFunc != nil { return cli.nodeRemoveFunc() } @@ -63,14 +62,14 @@ func (cli *fakeClient) TaskInspectWithRaw(_ context.Context, taskID string) (swa return swarm.Task{}, []byte{}, nil } -func (cli *fakeClient) TaskList(_ context.Context, options types.TaskListOptions) ([]swarm.Task, error) { +func (cli *fakeClient) TaskList(_ context.Context, options swarm.TaskListOptions) ([]swarm.Task, error) { if cli.taskListFunc != nil { return cli.taskListFunc(options) } return []swarm.Task{}, nil } -func (cli *fakeClient) ServiceInspectWithRaw(ctx context.Context, serviceID string, opts types.ServiceInspectOptions) (swarm.Service, []byte, error) { +func (cli *fakeClient) ServiceInspectWithRaw(ctx context.Context, serviceID string, opts swarm.ServiceInspectOptions) (swarm.Service, []byte, error) { if cli.serviceInspectFunc != nil { return cli.serviceInspectFunc(ctx, serviceID, opts) } diff --git a/cli/command/node/cmd.go b/cli/command/node/cmd.go index 28bd81f133..655f0170b7 100644 --- a/cli/command/node/cmd.go +++ b/cli/command/node/cmd.go @@ -6,7 +6,7 @@ import ( "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" "github.com/spf13/cobra" ) @@ -48,7 +48,7 @@ func Reference(ctx context.Context, apiClient client.APIClient, ref string) (str // If there's no node ID in /info, the node probably // isn't a manager. Call a swarm-specific endpoint to // get a more specific error message. - _, err = apiClient.NodeList(ctx, types.NodeListOptions{}) + _, err = apiClient.NodeList(ctx, swarm.NodeListOptions{}) if err != nil { return "", err } diff --git a/cli/command/node/completion.go b/cli/command/node/completion.go index 8b64861ac6..e9265d21c2 100644 --- a/cli/command/node/completion.go +++ b/cli/command/node/completion.go @@ -4,7 +4,7 @@ import ( "os" "github.com/docker/cli/cli/command/completion" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/swarm" "github.com/spf13/cobra" ) @@ -17,7 +17,7 @@ func completeNodeNames(dockerCLI completion.APIClientProvider) cobra.CompletionF // https://github.com/docker/cli/blob/f9ced58158d5e0b358052432244b483774a1983d/contrib/completion/bash/docker#L41-L43 showIDs := os.Getenv("DOCKER_COMPLETION_SHOW_NODE_IDS") == "yes" return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - list, err := dockerCLI.Client().NodeList(cmd.Context(), types.NodeListOptions{}) + list, err := dockerCLI.Client().NodeList(cmd.Context(), swarm.NodeListOptions{}) if err != nil { return nil, cobra.ShellCompDirectiveError } diff --git a/cli/command/node/list.go b/cli/command/node/list.go index 51b3f4afe1..3d319deeb9 100644 --- a/cli/command/node/list.go +++ b/cli/command/node/list.go @@ -10,7 +10,7 @@ import ( "github.com/docker/cli/cli/command/formatter" flagsHelper "github.com/docker/cli/cli/flags" "github.com/docker/cli/opts" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/system" "github.com/fvbommel/sortorder" "github.com/spf13/cobra" @@ -55,7 +55,7 @@ func runList(ctx context.Context, dockerCli command.Cli, options listOptions) er nodes, err := client.NodeList( ctx, - types.NodeListOptions{Filters: options.filter.Value()}) + swarm.NodeListOptions{Filters: options.filter.Value()}) if err != nil { return err } diff --git a/cli/command/node/ps.go b/cli/command/node/ps.go index 3174c6d5e6..c34ea0e676 100644 --- a/cli/command/node/ps.go +++ b/cli/command/node/ps.go @@ -10,7 +10,6 @@ import ( "github.com/docker/cli/cli/command/idresolver" "github.com/docker/cli/cli/command/task" "github.com/docker/cli/opts" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -84,7 +83,7 @@ func runPs(ctx context.Context, dockerCli command.Cli, options psOptions) error filter := options.filter.Value() filter.Add("node", node.ID) - nodeTasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter}) + nodeTasks, err := client.TaskList(ctx, swarm.TaskListOptions{Filters: filter}) if err != nil { errs = append(errs, err.Error()) continue diff --git a/cli/command/node/ps_test.go b/cli/command/node/ps_test.go index ea1273e6a4..66e4ce855b 100644 --- a/cli/command/node/ps_test.go +++ b/cli/command/node/ps_test.go @@ -10,7 +10,6 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test/builders" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/system" "gotest.tools/v3/assert" @@ -23,7 +22,7 @@ func TestNodePsErrors(t *testing.T) { flags map[string]string infoFunc func() (system.Info, error) nodeInspectFunc func() (swarm.Node, []byte, error) - taskListFunc func(options types.TaskListOptions) ([]swarm.Task, error) + taskListFunc func(options swarm.TaskListOptions) ([]swarm.Task, error) taskInspectFunc func(taskID string) (swarm.Task, []byte, error) expectedError string }{ @@ -42,7 +41,7 @@ func TestNodePsErrors(t *testing.T) { }, { args: []string{"nodeID"}, - taskListFunc: func(options types.TaskListOptions) ([]swarm.Task, error) { + taskListFunc: func(options swarm.TaskListOptions) ([]swarm.Task, error) { return []swarm.Task{}, errors.New("error returning the task list") }, expectedError: "error returning the task list", @@ -73,9 +72,9 @@ func TestNodePs(t *testing.T) { flags map[string]string infoFunc func() (system.Info, error) nodeInspectFunc func() (swarm.Node, []byte, error) - taskListFunc func(options types.TaskListOptions) ([]swarm.Task, error) + taskListFunc func(options swarm.TaskListOptions) ([]swarm.Task, error) taskInspectFunc func(taskID string) (swarm.Task, []byte, error) - serviceInspectFunc func(ctx context.Context, serviceID string, opts types.ServiceInspectOptions) (swarm.Service, []byte, error) + serviceInspectFunc func(ctx context.Context, serviceID string, opts swarm.ServiceInspectOptions) (swarm.Service, []byte, error) }{ { name: "simple", @@ -83,7 +82,7 @@ func TestNodePs(t *testing.T) { nodeInspectFunc: func() (swarm.Node, []byte, error) { return *builders.Node(), []byte{}, nil }, - taskListFunc: func(options types.TaskListOptions) ([]swarm.Task, error) { + taskListFunc: func(options swarm.TaskListOptions) ([]swarm.Task, error) { return []swarm.Task{ *builders.Task(builders.WithStatus(builders.Timestamp(time.Now().Add(-2*time.Hour)), builders.PortStatus([]swarm.PortConfig{ { @@ -94,7 +93,7 @@ func TestNodePs(t *testing.T) { }))), }, nil }, - serviceInspectFunc: func(ctx context.Context, serviceID string, opts types.ServiceInspectOptions) (swarm.Service, []byte, error) { + serviceInspectFunc: func(ctx context.Context, serviceID string, opts swarm.ServiceInspectOptions) (swarm.Service, []byte, error) { return swarm.Service{ ID: serviceID, Spec: swarm.ServiceSpec{ @@ -111,7 +110,7 @@ func TestNodePs(t *testing.T) { nodeInspectFunc: func() (swarm.Node, []byte, error) { return *builders.Node(), []byte{}, nil }, - taskListFunc: func(options types.TaskListOptions) ([]swarm.Task, error) { + taskListFunc: func(options swarm.TaskListOptions) ([]swarm.Task, error) { return []swarm.Task{ *builders.Task(builders.TaskID("taskID1"), builders.TaskServiceID("failure"), builders.WithStatus(builders.Timestamp(time.Now().Add(-2*time.Hour)), builders.StatusErr("a task error"))), @@ -121,7 +120,7 @@ func TestNodePs(t *testing.T) { builders.WithStatus(builders.Timestamp(time.Now().Add(-4*time.Hour)), builders.StatusErr("a task error"))), }, nil }, - serviceInspectFunc: func(ctx context.Context, serviceID string, opts types.ServiceInspectOptions) (swarm.Service, []byte, error) { + serviceInspectFunc: func(ctx context.Context, serviceID string, opts swarm.ServiceInspectOptions) (swarm.Service, []byte, error) { return swarm.Service{ ID: serviceID, Spec: swarm.ServiceSpec{ diff --git a/cli/command/node/remove.go b/cli/command/node/remove.go index 6ded0add42..c7768f51ea 100644 --- a/cli/command/node/remove.go +++ b/cli/command/node/remove.go @@ -7,7 +7,7 @@ import ( "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/swarm" "github.com/spf13/cobra" ) @@ -38,7 +38,7 @@ func runRemove(ctx context.Context, dockerCLI command.Cli, nodeIDs []string, opt var errs []error for _, id := range nodeIDs { - if err := apiClient.NodeRemove(ctx, id, types.NodeRemoveOptions{Force: opts.force}); err != nil { + if err := apiClient.NodeRemove(ctx, id, swarm.NodeRemoveOptions{Force: opts.force}); err != nil { errs = append(errs, err) continue } diff --git a/cli/command/service/client_test.go b/cli/command/service/client_test.go index eeb73a6e4a..8853fa21d3 100644 --- a/cli/command/service/client_test.go +++ b/cli/command/service/client_test.go @@ -4,7 +4,6 @@ import ( "context" "github.com/docker/cli/internal/test/builders" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/system" @@ -13,30 +12,30 @@ import ( type fakeClient struct { client.Client - serviceInspectWithRawFunc func(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error) - serviceUpdateFunc func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) - serviceListFunc func(context.Context, types.ServiceListOptions) ([]swarm.Service, error) - taskListFunc func(context.Context, types.TaskListOptions) ([]swarm.Task, error) + serviceInspectWithRawFunc func(ctx context.Context, serviceID string, options swarm.ServiceInspectOptions) (swarm.Service, []byte, error) + serviceUpdateFunc func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options swarm.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) + serviceListFunc func(context.Context, swarm.ServiceListOptions) ([]swarm.Service, error) + taskListFunc func(context.Context, swarm.TaskListOptions) ([]swarm.Task, error) infoFunc func(ctx context.Context) (system.Info, error) networkInspectFunc func(ctx context.Context, networkID string, options network.InspectOptions) (network.Inspect, error) - nodeListFunc func(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error) + nodeListFunc func(ctx context.Context, options swarm.NodeListOptions) ([]swarm.Node, error) } -func (f *fakeClient) NodeList(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error) { +func (f *fakeClient) NodeList(ctx context.Context, options swarm.NodeListOptions) ([]swarm.Node, error) { if f.nodeListFunc != nil { return f.nodeListFunc(ctx, options) } return nil, nil } -func (f *fakeClient) TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error) { +func (f *fakeClient) TaskList(ctx context.Context, options swarm.TaskListOptions) ([]swarm.Task, error) { if f.taskListFunc != nil { return f.taskListFunc(ctx, options) } return nil, nil } -func (f *fakeClient) ServiceInspectWithRaw(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error) { +func (f *fakeClient) ServiceInspectWithRaw(ctx context.Context, serviceID string, options swarm.ServiceInspectOptions) (swarm.Service, []byte, error) { if f.serviceInspectWithRawFunc != nil { return f.serviceInspectWithRawFunc(ctx, serviceID, options) } @@ -44,7 +43,7 @@ func (f *fakeClient) ServiceInspectWithRaw(ctx context.Context, serviceID string return *builders.Service(builders.ServiceID(serviceID)), []byte{}, nil } -func (f *fakeClient) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) { +func (f *fakeClient) ServiceList(ctx context.Context, options swarm.ServiceListOptions) ([]swarm.Service, error) { if f.serviceListFunc != nil { return f.serviceListFunc(ctx, options) } @@ -52,7 +51,7 @@ func (f *fakeClient) ServiceList(ctx context.Context, options types.ServiceListO return nil, nil } -func (f *fakeClient) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) { +func (f *fakeClient) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options swarm.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) { if f.serviceUpdateFunc != nil { return f.serviceUpdateFunc(ctx, serviceID, version, service, options) } diff --git a/cli/command/service/completion.go b/cli/command/service/completion.go index 58e689a711..613be94192 100644 --- a/cli/command/service/completion.go +++ b/cli/command/service/completion.go @@ -4,7 +4,7 @@ import ( "os" "github.com/docker/cli/cli/command/completion" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/swarm" "github.com/spf13/cobra" ) @@ -15,7 +15,7 @@ func completeServiceNames(dockerCLI completion.APIClientProvider) cobra.Completi // https://github.com/docker/cli/blob/f9ced58158d5e0b358052432244b483774a1983d/contrib/completion/bash/docker#L41-L43 showIDs := os.Getenv("DOCKER_COMPLETION_SHOW_SERVICE_IDS") == "yes" return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - list, err := dockerCLI.Client().ServiceList(cmd.Context(), types.ServiceListOptions{}) + list, err := dockerCLI.Client().ServiceList(cmd.Context(), swarm.ServiceListOptions{}) if err != nil { return nil, cobra.ShellCompDirectiveError } diff --git a/cli/command/service/create.go b/cli/command/service/create.go index fa06b32c2b..f63f65aefe 100644 --- a/cli/command/service/create.go +++ b/cli/command/service/create.go @@ -8,7 +8,6 @@ import ( "github.com/docker/cli/cli/command" "github.com/docker/cli/cli/command/completion" cliopts "github.com/docker/cli/opts" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/versions" "github.com/docker/docker/client" @@ -102,7 +101,7 @@ func newCreateCommand(dockerCLI command.Cli) *cobra.Command { func runCreate(ctx context.Context, dockerCLI command.Cli, flags *pflag.FlagSet, opts *serviceOptions) error { apiClient := dockerCLI.Client() - createOpts := types.ServiceCreateOptions{} + createOpts := swarm.ServiceCreateOptions{} service, err := opts.ToService(ctx, apiClient, flags) if err != nil { diff --git a/cli/command/service/inspect.go b/cli/command/service/inspect.go index dd27e91d2c..e3ae937125 100644 --- a/cli/command/service/inspect.go +++ b/cli/command/service/inspect.go @@ -13,8 +13,8 @@ import ( "github.com/docker/cli/cli/command/completion" "github.com/docker/cli/cli/command/formatter" flagsHelper "github.com/docker/cli/cli/flags" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/network" + "github.com/docker/docker/api/types/swarm" "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/pflag" @@ -66,7 +66,7 @@ func runInspect(ctx context.Context, dockerCli command.Cli, opts inspectOptions) getRef := func(ref string) (any, []byte, error) { // Service inspect shows defaults values in empty fields. - service, _, err := client.ServiceInspectWithRaw(ctx, ref, types.ServiceInspectOptions{InsertDefaults: true}) + service, _, err := client.ServiceInspectWithRaw(ctx, ref, swarm.ServiceInspectOptions{InsertDefaults: true}) if err == nil || !cerrdefs.IsNotFound(err) { return service, nil, err } diff --git a/cli/command/service/list.go b/cli/command/service/list.go index 03251eb25f..d2768cc0e1 100644 --- a/cli/command/service/list.go +++ b/cli/command/service/list.go @@ -9,7 +9,6 @@ import ( "github.com/docker/cli/cli/command/formatter" flagsHelper "github.com/docker/cli/cli/flags" "github.com/docker/cli/opts" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" @@ -57,7 +56,7 @@ func runList(ctx context.Context, dockerCLI command.Cli, options listOptions) er err error ) - listOpts := types.ServiceListOptions{ + listOpts := swarm.ServiceListOptions{ Filters: options.filter.Value(), // When not running "quiet", also get service status (number of running // and desired tasks). Note that this is only supported on API v1.41 and @@ -147,7 +146,7 @@ func AppendServiceStatus(ctx context.Context, c client.APIClient, services []swa return services, nil } - tasks, err := c.TaskList(ctx, types.TaskListOptions{Filters: taskFilter}) + tasks, err := c.TaskList(ctx, swarm.TaskListOptions{Filters: taskFilter}) if err != nil { return nil, err } @@ -184,7 +183,7 @@ func AppendServiceStatus(ctx context.Context, c client.APIClient, services []swa } func getActiveNodes(ctx context.Context, c client.NodeAPIClient) (map[string]struct{}, error) { - nodes, err := c.NodeList(ctx, types.NodeListOptions{}) + nodes, err := c.NodeList(ctx, swarm.NodeListOptions{}) if err != nil { return nil, err } diff --git a/cli/command/service/list_test.go b/cli/command/service/list_test.go index 65da3c5589..c1defc768e 100644 --- a/cli/command/service/list_test.go +++ b/cli/command/service/list_test.go @@ -9,7 +9,6 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test/builders" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/versions" "gotest.tools/v3/assert" @@ -19,7 +18,7 @@ import ( func TestServiceListOrder(t *testing.T) { cli := test.NewFakeCli(&fakeClient{ - serviceListFunc: func(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(ctx context.Context, options swarm.ServiceListOptions) ([]swarm.Service, error) { return []swarm.Service{ newService("a57dbe8", "service-1-foo"), newService("a57dbdd", "service-10-foo"), @@ -173,7 +172,7 @@ func TestServiceListServiceStatus(t *testing.T) { tc.cluster = generateCluster(t, tc.opts) } cli := test.NewFakeCli(&fakeClient{ - serviceListFunc: func(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(ctx context.Context, options swarm.ServiceListOptions) ([]swarm.Service, error) { if !options.Status || versions.LessThan(tc.opts.apiVersion, "1.41") { // Don't return "ServiceStatus" if not requested, or on older API versions for i := range tc.cluster.services { @@ -182,10 +181,10 @@ func TestServiceListServiceStatus(t *testing.T) { } return tc.cluster.services, nil }, - taskListFunc: func(context.Context, types.TaskListOptions) ([]swarm.Task, error) { + taskListFunc: func(context.Context, swarm.TaskListOptions) ([]swarm.Task, error) { return tc.cluster.tasks, nil }, - nodeListFunc: func(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error) { + nodeListFunc: func(ctx context.Context, options swarm.NodeListOptions) ([]swarm.Node, error) { return tc.cluster.nodes, nil }, }) diff --git a/cli/command/service/logs.go b/cli/command/service/logs.go index 9098f2317c..7d394267b8 100644 --- a/cli/command/service/logs.go +++ b/cli/command/service/logs.go @@ -15,7 +15,6 @@ import ( "github.com/docker/cli/cli/command/completion" "github.com/docker/cli/cli/command/idresolver" "github.com/docker/cli/internal/logdetails" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" @@ -91,7 +90,7 @@ func runLogs(ctx context.Context, dockerCli command.Cli, opts *logsOptions) erro logfunc func(context.Context, string, container.LogsOptions) (io.ReadCloser, error) ) - service, _, err := apiClient.ServiceInspectWithRaw(ctx, opts.target, types.ServiceInspectOptions{}) + service, _, err := apiClient.ServiceInspectWithRaw(ctx, opts.target, swarm.ServiceInspectOptions{}) if err != nil { // if it's any error other than service not found, it's Real if !cerrdefs.IsNotFound(err) { diff --git a/cli/command/service/progress/progress.go b/cli/command/service/progress/progress.go index 09da18774c..c5c00e41c6 100644 --- a/cli/command/service/progress/progress.go +++ b/cli/command/service/progress/progress.go @@ -11,7 +11,6 @@ import ( "strings" "time" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" @@ -89,7 +88,7 @@ func ServiceProgress(ctx context.Context, apiClient client.APIClient, serviceID ) for { - service, _, err := apiClient.ServiceInspectWithRaw(ctx, serviceID, types.ServiceInspectOptions{}) + service, _, err := apiClient.ServiceInspectWithRaw(ctx, serviceID, swarm.ServiceInspectOptions{}) if err != nil { return err } @@ -143,7 +142,7 @@ func ServiceProgress(ctx context.Context, apiClient client.APIClient, serviceID return nil } - tasks, err := apiClient.TaskList(ctx, types.TaskListOptions{Filters: filters.NewArgs( + tasks, err := apiClient.TaskList(ctx, swarm.TaskListOptions{Filters: filters.NewArgs( filters.KeyValuePair{Key: "service", Value: service.ID}, filters.KeyValuePair{Key: "_up-to-date", Value: "true"}, )}) @@ -217,7 +216,7 @@ func ServiceProgress(ctx context.Context, apiClient client.APIClient, serviceID // // TODO(thaJeztah): this should really be a filter on [apiClient.NodeList] instead of being filtered on the client side. func getActiveNodes(ctx context.Context, apiClient client.NodeAPIClient) (map[string]struct{}, error) { - nodes, err := apiClient.NodeList(ctx, types.NodeListOptions{}) + nodes, err := apiClient.NodeList(ctx, swarm.NodeListOptions{}) if err != nil { return nil, err } diff --git a/cli/command/service/ps.go b/cli/command/service/ps.go index a818a5695c..601014054d 100644 --- a/cli/command/service/ps.go +++ b/cli/command/service/ps.go @@ -11,8 +11,8 @@ import ( "github.com/docker/cli/cli/command/node" "github.com/docker/cli/cli/command/task" "github.com/docker/cli/opts" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" + "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -68,7 +68,7 @@ func runPS(ctx context.Context, dockerCli command.Cli, options psOptions) error return err } - tasks, err := apiClient.TaskList(ctx, types.TaskListOptions{Filters: filter}) + tasks, err := apiClient.TaskList(ctx, swarm.TaskListOptions{Filters: filter}) if err != nil { return err } @@ -98,11 +98,11 @@ func createFilter(ctx context.Context, apiClient client.APIClient, options psOpt serviceIDFilter.Add("id", service) serviceNameFilter.Add("name", service) } - serviceByIDList, err := apiClient.ServiceList(ctx, types.ServiceListOptions{Filters: serviceIDFilter}) + serviceByIDList, err := apiClient.ServiceList(ctx, swarm.ServiceListOptions{Filters: serviceIDFilter}) if err != nil { return filter, nil, err } - serviceByNameList, err := apiClient.ServiceList(ctx, types.ServiceListOptions{Filters: serviceNameFilter}) + serviceByNameList, err := apiClient.ServiceList(ctx, swarm.ServiceListOptions{Filters: serviceNameFilter}) if err != nil { return filter, nil, err } diff --git a/cli/command/service/ps_test.go b/cli/command/service/ps_test.go index 470c4b09dc..5301846a55 100644 --- a/cli/command/service/ps_test.go +++ b/cli/command/service/ps_test.go @@ -6,7 +6,6 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/cli/opts" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/system" @@ -17,7 +16,7 @@ import ( func TestCreateFilter(t *testing.T) { client := &fakeClient{ - serviceListFunc: func(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(ctx context.Context, options swarm.ServiceListOptions) ([]swarm.Service, error) { return []swarm.Service{ {ID: "idmatch"}, {ID: "idprefixmatch"}, @@ -49,7 +48,7 @@ func TestCreateFilter(t *testing.T) { func TestCreateFilterWithAmbiguousIDPrefixError(t *testing.T) { client := &fakeClient{ - serviceListFunc: func(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(ctx context.Context, options swarm.ServiceListOptions) ([]swarm.Service, error) { return []swarm.Service{ {ID: "aaaone"}, {ID: "aaatwo"}, @@ -76,7 +75,7 @@ func TestCreateFilterNoneFound(t *testing.T) { func TestRunPSWarnsOnNotFound(t *testing.T) { client := &fakeClient{ - serviceListFunc: func(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(ctx context.Context, options swarm.ServiceListOptions) ([]swarm.Service, error) { return []swarm.Service{ {ID: "foo"}, }, nil @@ -97,10 +96,10 @@ func TestRunPSWarnsOnNotFound(t *testing.T) { func TestRunPSQuiet(t *testing.T) { client := &fakeClient{ - serviceListFunc: func(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(ctx context.Context, options swarm.ServiceListOptions) ([]swarm.Service, error) { return []swarm.Service{{ID: "foo"}}, nil }, - taskListFunc: func(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error) { + taskListFunc: func(ctx context.Context, options swarm.TaskListOptions) ([]swarm.Task, error) { return []swarm.Task{{ID: "sxabyp0obqokwekpun4rjo0b3"}}, nil }, } diff --git a/cli/command/service/rollback.go b/cli/command/service/rollback.go index f0f2a7c6fb..3b4a445f2e 100644 --- a/cli/command/service/rollback.go +++ b/cli/command/service/rollback.go @@ -7,7 +7,7 @@ import ( "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" "github.com/docker/cli/cli/command/completion" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/versions" "github.com/spf13/cobra" "github.com/spf13/pflag" @@ -43,12 +43,12 @@ func newRollbackCommand(dockerCli command.Cli) *cobra.Command { func runRollback(ctx context.Context, dockerCLI command.Cli, options *serviceOptions, serviceID string) error { apiClient := dockerCLI.Client() - service, _, err := apiClient.ServiceInspectWithRaw(ctx, serviceID, types.ServiceInspectOptions{}) + service, _, err := apiClient.ServiceInspectWithRaw(ctx, serviceID, swarm.ServiceInspectOptions{}) if err != nil { return err } - response, err := apiClient.ServiceUpdate(ctx, service.ID, service.Version, service.Spec, types.ServiceUpdateOptions{ + response, err := apiClient.ServiceUpdate(ctx, service.ID, service.Version, service.Spec, swarm.ServiceUpdateOptions{ Rollback: "previous", // TODO(thaJeztah): this should have a const defined }) if err != nil { diff --git a/cli/command/service/rollback_test.go b/cli/command/service/rollback_test.go index 968cbdfa36..a308584344 100644 --- a/cli/command/service/rollback_test.go +++ b/cli/command/service/rollback_test.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" @@ -18,7 +17,7 @@ func TestRollback(t *testing.T) { testCases := []struct { name string args []string - serviceUpdateFunc func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) + serviceUpdateFunc func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options swarm.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) expectedDockerCliErr string }{ { @@ -28,7 +27,7 @@ func TestRollback(t *testing.T) { { name: "rollback-service-with-warnings", args: []string{"service-id"}, - serviceUpdateFunc: func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) { + serviceUpdateFunc: func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options swarm.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) { response := swarm.ServiceUpdateResponse{} response.Warnings = []string{ @@ -59,8 +58,8 @@ func TestRollbackWithErrors(t *testing.T) { testCases := []struct { name string args []string - serviceInspectWithRawFunc func(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error) - serviceUpdateFunc func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) + serviceInspectWithRawFunc func(ctx context.Context, serviceID string, options swarm.ServiceInspectOptions) (swarm.Service, []byte, error) + serviceUpdateFunc func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options swarm.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) expectedError string }{ { @@ -75,7 +74,7 @@ func TestRollbackWithErrors(t *testing.T) { { name: "service-does-not-exists", args: []string{"service-id"}, - serviceInspectWithRawFunc: func(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error) { + serviceInspectWithRawFunc: func(ctx context.Context, serviceID string, options swarm.ServiceInspectOptions) (swarm.Service, []byte, error) { return swarm.Service{}, []byte{}, fmt.Errorf("no such services: %s", serviceID) }, expectedError: "no such services: service-id", @@ -83,7 +82,7 @@ func TestRollbackWithErrors(t *testing.T) { { name: "service-update-failed", args: []string{"service-id"}, - serviceUpdateFunc: func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) { + serviceUpdateFunc: func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options swarm.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) { return swarm.ServiceUpdateResponse{}, fmt.Errorf("no such services: %s", serviceID) }, expectedError: "no such services: service-id", diff --git a/cli/command/service/scale.go b/cli/command/service/scale.go index 6eade0c6b7..2d1acf3d89 100644 --- a/cli/command/service/scale.go +++ b/cli/command/service/scale.go @@ -9,7 +9,7 @@ import ( "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/versions" "github.com/docker/docker/client" "github.com/spf13/cobra" @@ -94,7 +94,7 @@ func runScale(ctx context.Context, dockerCLI command.Cli, options *scaleOptions, } func runServiceScale(ctx context.Context, apiClient client.ServiceAPIClient, serviceID string, scale uint64) (warnings []string, _ error) { - service, _, err := apiClient.ServiceInspectWithRaw(ctx, serviceID, types.ServiceInspectOptions{}) + service, _, err := apiClient.ServiceInspectWithRaw(ctx, serviceID, swarm.ServiceInspectOptions{}) if err != nil { return nil, err } @@ -109,7 +109,7 @@ func runServiceScale(ctx context.Context, apiClient client.ServiceAPIClient, ser return nil, errors.New("scale can only be used with replicated or replicated-job mode") } - response, err := apiClient.ServiceUpdate(ctx, service.ID, service.Version, service.Spec, types.ServiceUpdateOptions{}) + response, err := apiClient.ServiceUpdate(ctx, service.ID, service.Version, service.Spec, swarm.ServiceUpdateOptions{}) if err != nil { return nil, err } diff --git a/cli/command/service/update.go b/cli/command/service/update.go index ec70d3d988..2b75b6b59b 100644 --- a/cli/command/service/update.go +++ b/cli/command/service/update.go @@ -12,7 +12,6 @@ import ( "github.com/docker/cli/cli/command/completion" "github.com/docker/cli/opts" "github.com/docker/cli/opts/swarmopts" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" mounttypes "github.com/docker/docker/api/types/mount" "github.com/docker/docker/api/types/network" @@ -156,7 +155,7 @@ func newListOptsVarWithValidator(validator opts.ValidatorFctType) *opts.ListOpts func runUpdate(ctx context.Context, dockerCLI command.Cli, flags *pflag.FlagSet, options *serviceOptions, serviceID string) error { apiClient := dockerCLI.Client() - service, _, err := apiClient.ServiceInspectWithRaw(ctx, serviceID, types.ServiceInspectOptions{}) + service, _, err := apiClient.ServiceInspectWithRaw(ctx, serviceID, swarm.ServiceInspectOptions{}) if err != nil { return err } @@ -201,7 +200,7 @@ func runUpdate(ctx context.Context, dockerCLI command.Cli, flags *pflag.FlagSet, } } - updateOpts := types.ServiceUpdateOptions{} + updateOpts := swarm.ServiceUpdateOptions{} if serverSideRollback { updateOpts.Rollback = "previous" } @@ -255,9 +254,9 @@ func runUpdate(ctx context.Context, dockerCLI command.Cli, flags *pflag.FlagSet, } updateOpts.EncodedRegistryAuth = encodedAuth case clientSideRollback: - updateOpts.RegistryAuthFrom = types.RegistryAuthFromPreviousSpec + updateOpts.RegistryAuthFrom = swarm.RegistryAuthFromPreviousSpec default: - updateOpts.RegistryAuthFrom = types.RegistryAuthFromSpec + updateOpts.RegistryAuthFrom = swarm.RegistryAuthFromSpec } response, err := apiClient.ServiceUpdate(ctx, service.ID, service.Version, *spec, updateOpts) diff --git a/cli/command/stack/client_test.go b/cli/command/stack/client_test.go index d1755e7cda..a3b4bcdd05 100644 --- a/cli/command/stack/client_test.go +++ b/cli/command/stack/client_test.go @@ -28,15 +28,15 @@ type fakeClient struct { removedSecrets []string removedConfigs []string - serviceListFunc func(options types.ServiceListOptions) ([]swarm.Service, error) + serviceListFunc func(options swarm.ServiceListOptions) ([]swarm.Service, error) networkListFunc func(options network.ListOptions) ([]network.Summary, error) secretListFunc func(options swarm.SecretListOptions) ([]swarm.Secret, error) configListFunc func(options swarm.ConfigListOptions) ([]swarm.Config, error) - nodeListFunc func(options types.NodeListOptions) ([]swarm.Node, error) - taskListFunc func(options types.TaskListOptions) ([]swarm.Task, error) + nodeListFunc func(options swarm.NodeListOptions) ([]swarm.Node, error) + taskListFunc func(options swarm.TaskListOptions) ([]swarm.Task, error) nodeInspectWithRaw func(ref string) (swarm.Node, []byte, error) - serviceUpdateFunc func(serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) + serviceUpdateFunc func(serviceID string, version swarm.Version, service swarm.ServiceSpec, options swarm.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) serviceRemoveFunc func(serviceID string) error networkRemoveFunc func(networkID string) error @@ -55,7 +55,7 @@ func (cli *fakeClient) ClientVersion() string { return cli.version } -func (cli *fakeClient) ServiceList(_ context.Context, options types.ServiceListOptions) ([]swarm.Service, error) { +func (cli *fakeClient) ServiceList(_ context.Context, options swarm.ServiceListOptions) ([]swarm.Service, error) { if cli.serviceListFunc != nil { return cli.serviceListFunc(options) } @@ -115,14 +115,14 @@ func (cli *fakeClient) ConfigList(_ context.Context, options swarm.ConfigListOpt return configsList, nil } -func (cli *fakeClient) TaskList(_ context.Context, options types.TaskListOptions) ([]swarm.Task, error) { +func (cli *fakeClient) TaskList(_ context.Context, options swarm.TaskListOptions) ([]swarm.Task, error) { if cli.taskListFunc != nil { return cli.taskListFunc(options) } return []swarm.Task{}, nil } -func (cli *fakeClient) NodeList(_ context.Context, options types.NodeListOptions) ([]swarm.Node, error) { +func (cli *fakeClient) NodeList(_ context.Context, options swarm.NodeListOptions) ([]swarm.Node, error) { if cli.nodeListFunc != nil { return cli.nodeListFunc(options) } @@ -136,7 +136,7 @@ func (cli *fakeClient) NodeInspectWithRaw(_ context.Context, ref string) (swarm. return swarm.Node{}, nil, nil } -func (cli *fakeClient) ServiceUpdate(_ context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) { +func (cli *fakeClient) ServiceUpdate(_ context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options swarm.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) { if cli.serviceUpdateFunc != nil { return cli.serviceUpdateFunc(serviceID, version, service, options) } @@ -180,7 +180,7 @@ func (cli *fakeClient) ConfigRemove(_ context.Context, configID string) error { return nil } -func (*fakeClient) ServiceInspectWithRaw(_ context.Context, serviceID string, _ types.ServiceInspectOptions) (swarm.Service, []byte, error) { +func (*fakeClient) ServiceInspectWithRaw(_ context.Context, serviceID string, _ swarm.ServiceInspectOptions) (swarm.Service, []byte, error) { return swarm.Service{ ID: serviceID, Spec: swarm.ServiceSpec{ diff --git a/cli/command/stack/list_test.go b/cli/command/stack/list_test.go index 92afa22f69..cc09794187 100644 --- a/cli/command/stack/list_test.go +++ b/cli/command/stack/list_test.go @@ -7,7 +7,6 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test/builders" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "gotest.tools/v3/assert" "gotest.tools/v3/golden" @@ -17,7 +16,7 @@ func TestListErrors(t *testing.T) { testCases := []struct { args []string flags map[string]string - serviceListFunc func(options types.ServiceListOptions) ([]swarm.Service, error) + serviceListFunc func(options swarm.ServiceListOptions) ([]swarm.Service, error) expectedError string }{ { @@ -33,14 +32,14 @@ func TestListErrors(t *testing.T) { }, { args: []string{}, - serviceListFunc: func(options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(options swarm.ServiceListOptions) ([]swarm.Service, error) { return []swarm.Service{}, errors.New("error getting services") }, expectedError: "error getting services", }, { args: []string{}, - serviceListFunc: func(options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(options swarm.ServiceListOptions) ([]swarm.Service, error) { return []swarm.Service{*builders.Service()}, nil }, expectedError: "cannot get label", @@ -115,7 +114,7 @@ func TestStackList(t *testing.T) { ) } cli := test.NewFakeCli(&fakeClient{ - serviceListFunc: func(options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(options swarm.ServiceListOptions) ([]swarm.Service, error) { return services, nil }, }) diff --git a/cli/command/stack/ps_test.go b/cli/command/stack/ps_test.go index 117bdeaf8c..2994bbf354 100644 --- a/cli/command/stack/ps_test.go +++ b/cli/command/stack/ps_test.go @@ -9,7 +9,6 @@ import ( "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test/builders" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" @@ -19,7 +18,7 @@ import ( func TestStackPsErrors(t *testing.T) { testCases := []struct { args []string - taskListFunc func(options types.TaskListOptions) ([]swarm.Task, error) + taskListFunc func(options swarm.TaskListOptions) ([]swarm.Task, error) expectedError string }{ { @@ -32,7 +31,7 @@ func TestStackPsErrors(t *testing.T) { }, { args: []string{"foo"}, - taskListFunc: func(options types.TaskListOptions) ([]swarm.Task, error) { + taskListFunc: func(options swarm.TaskListOptions) ([]swarm.Task, error) { return nil, errors.New("error getting tasks") }, expectedError: "error getting tasks", @@ -55,7 +54,7 @@ func TestStackPsErrors(t *testing.T) { func TestStackPs(t *testing.T) { testCases := []struct { doc string - taskListFunc func(types.TaskListOptions) ([]swarm.Task, error) + taskListFunc func(swarm.TaskListOptions) ([]swarm.Task, error) nodeInspectWithRaw func(string) (swarm.Node, []byte, error) config configfile.ConfigFile args []string @@ -70,7 +69,7 @@ func TestStackPs(t *testing.T) { }, { doc: "WithEmptyStack", - taskListFunc: func(options types.TaskListOptions) ([]swarm.Task, error) { + taskListFunc: func(options swarm.TaskListOptions) ([]swarm.Task, error) { return []swarm.Task{}, nil }, args: []string{"foo"}, @@ -78,7 +77,7 @@ func TestStackPs(t *testing.T) { }, { doc: "WithQuietOption", - taskListFunc: func(options types.TaskListOptions) ([]swarm.Task, error) { + taskListFunc: func(options swarm.TaskListOptions) ([]swarm.Task, error) { return []swarm.Task{*builders.Task(builders.TaskID("id-foo"))}, nil }, args: []string{"foo"}, @@ -89,7 +88,7 @@ func TestStackPs(t *testing.T) { }, { doc: "WithNoTruncOption", - taskListFunc: func(options types.TaskListOptions) ([]swarm.Task, error) { + taskListFunc: func(options swarm.TaskListOptions) ([]swarm.Task, error) { return []swarm.Task{*builders.Task(builders.TaskID("xn4cypcov06f2w8gsbaf2lst3"))}, nil }, args: []string{"foo"}, @@ -101,7 +100,7 @@ func TestStackPs(t *testing.T) { }, { doc: "WithNoResolveOption", - taskListFunc: func(options types.TaskListOptions) ([]swarm.Task, error) { + taskListFunc: func(options swarm.TaskListOptions) ([]swarm.Task, error) { return []swarm.Task{*builders.Task( builders.TaskNodeID("id-node-foo"), )}, nil @@ -118,7 +117,7 @@ func TestStackPs(t *testing.T) { }, { doc: "WithFormat", - taskListFunc: func(options types.TaskListOptions) ([]swarm.Task, error) { + taskListFunc: func(options swarm.TaskListOptions) ([]swarm.Task, error) { return []swarm.Task{*builders.Task(builders.TaskServiceID("service-id-foo"))}, nil }, args: []string{"foo"}, @@ -129,7 +128,7 @@ func TestStackPs(t *testing.T) { }, { doc: "WithConfigFormat", - taskListFunc: func(options types.TaskListOptions) ([]swarm.Task, error) { + taskListFunc: func(options swarm.TaskListOptions) ([]swarm.Task, error) { return []swarm.Task{*builders.Task(builders.TaskServiceID("service-id-foo"))}, nil }, config: configfile.ConfigFile{ @@ -140,7 +139,7 @@ func TestStackPs(t *testing.T) { }, { doc: "WithoutFormat", - taskListFunc: func(options types.TaskListOptions) ([]swarm.Task, error) { + taskListFunc: func(options swarm.TaskListOptions) ([]swarm.Task, error) { return []swarm.Task{*builders.Task( builders.TaskID("id-foo"), builders.TaskServiceID("service-id-foo"), diff --git a/cli/command/stack/services_test.go b/cli/command/stack/services_test.go index ca71ab9779..8d79dbeadd 100644 --- a/cli/command/stack/services_test.go +++ b/cli/command/stack/services_test.go @@ -8,7 +8,6 @@ import ( "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test/builders" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" @@ -19,37 +18,37 @@ func TestStackServicesErrors(t *testing.T) { testCases := []struct { args []string flags map[string]string - serviceListFunc func(options types.ServiceListOptions) ([]swarm.Service, error) - nodeListFunc func(options types.NodeListOptions) ([]swarm.Node, error) - taskListFunc func(options types.TaskListOptions) ([]swarm.Task, error) + serviceListFunc func(options swarm.ServiceListOptions) ([]swarm.Service, error) + nodeListFunc func(options swarm.NodeListOptions) ([]swarm.Node, error) + taskListFunc func(options swarm.TaskListOptions) ([]swarm.Task, error) expectedError string }{ { args: []string{"foo"}, - serviceListFunc: func(options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(options swarm.ServiceListOptions) ([]swarm.Service, error) { return nil, errors.New("error getting services") }, expectedError: "error getting services", }, { args: []string{"foo"}, - serviceListFunc: func(options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(options swarm.ServiceListOptions) ([]swarm.Service, error) { return []swarm.Service{*builders.Service(builders.GlobalService())}, nil }, - nodeListFunc: func(options types.NodeListOptions) ([]swarm.Node, error) { + nodeListFunc: func(options swarm.NodeListOptions) ([]swarm.Node, error) { return nil, errors.New("error getting nodes") }, - taskListFunc: func(options types.TaskListOptions) ([]swarm.Task, error) { + taskListFunc: func(options swarm.TaskListOptions) ([]swarm.Task, error) { return []swarm.Task{*builders.Task()}, nil }, expectedError: "error getting nodes", }, { args: []string{"foo"}, - serviceListFunc: func(options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(options swarm.ServiceListOptions) ([]swarm.Service, error) { return []swarm.Service{*builders.Service(builders.GlobalService())}, nil }, - taskListFunc: func(options types.TaskListOptions) ([]swarm.Task, error) { + taskListFunc: func(options swarm.TaskListOptions) ([]swarm.Task, error) { return nil, errors.New("error getting tasks") }, expectedError: "error getting tasks", @@ -59,7 +58,7 @@ func TestStackServicesErrors(t *testing.T) { flags: map[string]string{ "format": "{{invalid format}}", }, - serviceListFunc: func(options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(options swarm.ServiceListOptions) ([]swarm.Service, error) { return []swarm.Service{*builders.Service()}, nil }, expectedError: "template parsing error", @@ -96,7 +95,7 @@ func TestRunServicesWithEmptyName(t *testing.T) { func TestStackServicesEmptyServiceList(t *testing.T) { fakeCli := test.NewFakeCli(&fakeClient{ - serviceListFunc: func(options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(options swarm.ServiceListOptions) ([]swarm.Service, error) { return []swarm.Service{}, nil }, }) @@ -109,7 +108,7 @@ func TestStackServicesEmptyServiceList(t *testing.T) { func TestStackServicesWithQuietOption(t *testing.T) { cli := test.NewFakeCli(&fakeClient{ - serviceListFunc: func(options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(options swarm.ServiceListOptions) ([]swarm.Service, error) { return []swarm.Service{*builders.Service(builders.ServiceID("id-foo"))}, nil }, }) @@ -122,7 +121,7 @@ func TestStackServicesWithQuietOption(t *testing.T) { func TestStackServicesWithFormat(t *testing.T) { cli := test.NewFakeCli(&fakeClient{ - serviceListFunc: func(options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(options swarm.ServiceListOptions) ([]swarm.Service, error) { return []swarm.Service{ *builders.Service(builders.ServiceName("service-name-foo")), }, nil @@ -137,7 +136,7 @@ func TestStackServicesWithFormat(t *testing.T) { func TestStackServicesWithConfigFormat(t *testing.T) { cli := test.NewFakeCli(&fakeClient{ - serviceListFunc: func(options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(options swarm.ServiceListOptions) ([]swarm.Service, error) { return []swarm.Service{ *builders.Service(builders.ServiceName("service-name-foo")), }, nil @@ -154,7 +153,7 @@ func TestStackServicesWithConfigFormat(t *testing.T) { func TestStackServicesWithoutFormat(t *testing.T) { cli := test.NewFakeCli(&fakeClient{ - serviceListFunc: func(options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(options swarm.ServiceListOptions) ([]swarm.Service, error) { return []swarm.Service{*builders.Service( builders.ServiceName("name-foo"), builders.ServiceID("id-foo"), diff --git a/cli/command/stack/swarm/client_test.go b/cli/command/stack/swarm/client_test.go index 525651bae2..b072b35c5e 100644 --- a/cli/command/stack/swarm/client_test.go +++ b/cli/command/stack/swarm/client_test.go @@ -28,15 +28,15 @@ type fakeClient struct { removedSecrets []string removedConfigs []string - serviceListFunc func(options types.ServiceListOptions) ([]swarm.Service, error) + serviceListFunc func(options swarm.ServiceListOptions) ([]swarm.Service, error) networkListFunc func(options network.ListOptions) ([]network.Summary, error) secretListFunc func(options swarm.SecretListOptions) ([]swarm.Secret, error) configListFunc func(options swarm.ConfigListOptions) ([]swarm.Config, error) - nodeListFunc func(options types.NodeListOptions) ([]swarm.Node, error) - taskListFunc func(options types.TaskListOptions) ([]swarm.Task, error) + nodeListFunc func(options swarm.NodeListOptions) ([]swarm.Node, error) + taskListFunc func(options swarm.TaskListOptions) ([]swarm.Task, error) nodeInspectWithRaw func(ref string) (swarm.Node, []byte, error) - serviceUpdateFunc func(serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) + serviceUpdateFunc func(serviceID string, version swarm.Version, service swarm.ServiceSpec, options swarm.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) serviceRemoveFunc func(serviceID string) error networkRemoveFunc func(networkID string) error @@ -55,7 +55,7 @@ func (cli *fakeClient) ClientVersion() string { return cli.version } -func (cli *fakeClient) ServiceList(_ context.Context, options types.ServiceListOptions) ([]swarm.Service, error) { +func (cli *fakeClient) ServiceList(_ context.Context, options swarm.ServiceListOptions) ([]swarm.Service, error) { if cli.serviceListFunc != nil { return cli.serviceListFunc(options) } @@ -115,14 +115,14 @@ func (cli *fakeClient) ConfigList(_ context.Context, options swarm.ConfigListOpt return configsList, nil } -func (cli *fakeClient) TaskList(_ context.Context, options types.TaskListOptions) ([]swarm.Task, error) { +func (cli *fakeClient) TaskList(_ context.Context, options swarm.TaskListOptions) ([]swarm.Task, error) { if cli.taskListFunc != nil { return cli.taskListFunc(options) } return []swarm.Task{}, nil } -func (cli *fakeClient) NodeList(_ context.Context, options types.NodeListOptions) ([]swarm.Node, error) { +func (cli *fakeClient) NodeList(_ context.Context, options swarm.NodeListOptions) ([]swarm.Node, error) { if cli.nodeListFunc != nil { return cli.nodeListFunc(options) } @@ -136,7 +136,7 @@ func (cli *fakeClient) NodeInspectWithRaw(_ context.Context, ref string) (swarm. return swarm.Node{}, nil, nil } -func (cli *fakeClient) ServiceUpdate(_ context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) { +func (cli *fakeClient) ServiceUpdate(_ context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options swarm.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) { if cli.serviceUpdateFunc != nil { return cli.serviceUpdateFunc(serviceID, version, service, options) } diff --git a/cli/command/stack/swarm/common.go b/cli/command/stack/swarm/common.go index 45af48b5fe..d9a1e097f5 100644 --- a/cli/command/stack/swarm/common.go +++ b/cli/command/stack/swarm/common.go @@ -5,7 +5,6 @@ import ( "github.com/docker/cli/cli/compose/convert" "github.com/docker/cli/opts" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/swarm" @@ -31,7 +30,7 @@ func getAllStacksFilter() filters.Args { } func getStackServices(ctx context.Context, apiclient client.APIClient, namespace string) ([]swarm.Service, error) { - return apiclient.ServiceList(ctx, types.ServiceListOptions{Filters: getStackFilter(namespace)}) + return apiclient.ServiceList(ctx, swarm.ServiceListOptions{Filters: getStackFilter(namespace)}) } func getStackNetworks(ctx context.Context, apiclient client.APIClient, namespace string) ([]network.Summary, error) { @@ -47,5 +46,5 @@ func getStackConfigs(ctx context.Context, apiclient client.APIClient, namespace } func getStackTasks(ctx context.Context, apiclient client.APIClient, namespace string) ([]swarm.Task, error) { - return apiclient.TaskList(ctx, types.TaskListOptions{Filters: getStackFilter(namespace)}) + return apiclient.TaskList(ctx, swarm.TaskListOptions{Filters: getStackFilter(namespace)}) } diff --git a/cli/command/stack/swarm/deploy_composefile.go b/cli/command/stack/swarm/deploy_composefile.go index 771df89d58..edde88962a 100644 --- a/cli/command/stack/swarm/deploy_composefile.go +++ b/cli/command/stack/swarm/deploy_composefile.go @@ -11,7 +11,6 @@ import ( "github.com/docker/cli/cli/command/stack/options" "github.com/docker/cli/cli/compose/convert" composetypes "github.com/docker/cli/cli/compose/types" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/swarm" @@ -221,7 +220,7 @@ func deployServices(ctx context.Context, dockerCLI command.Cli, services map[str if service, exists := existingServiceMap[name]; exists { _, _ = fmt.Fprintf(out, "Updating service %s (id: %s)\n", name, service.ID) - updateOpts := types.ServiceUpdateOptions{EncodedRegistryAuth: encodedAuth} + updateOpts := swarm.ServiceUpdateOptions{EncodedRegistryAuth: encodedAuth} switch resolveImage { case ResolveImageAlways: @@ -266,7 +265,7 @@ func deployServices(ctx context.Context, dockerCLI command.Cli, services map[str } else { _, _ = fmt.Fprintln(out, "Creating service", name) - createOpts := types.ServiceCreateOptions{EncodedRegistryAuth: encodedAuth} + createOpts := swarm.ServiceCreateOptions{EncodedRegistryAuth: encodedAuth} // query registry if flag disabling it was not set if resolveImage == ResolveImageAlways || resolveImage == ResolveImageChanged { diff --git a/cli/command/stack/swarm/deploy_test.go b/cli/command/stack/swarm/deploy_test.go index 2452ad6f64..1c62eb3e98 100644 --- a/cli/command/stack/swarm/deploy_test.go +++ b/cli/command/stack/swarm/deploy_test.go @@ -6,7 +6,6 @@ import ( "github.com/docker/cli/cli/compose/convert" "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" @@ -33,12 +32,12 @@ func TestServiceUpdateResolveImageChanged(t *testing.T) { namespace := convert.NewNamespace("mystack") var ( - receivedOptions types.ServiceUpdateOptions + receivedOptions swarm.ServiceUpdateOptions receivedService swarm.ServiceSpec ) client := test.NewFakeCli(&fakeClient{ - serviceListFunc: func(options types.ServiceListOptions) ([]swarm.Service, error) { + serviceListFunc: func(options swarm.ServiceListOptions) ([]swarm.Service, error) { return []swarm.Service{ { Spec: swarm.ServiceSpec{ @@ -56,7 +55,7 @@ func TestServiceUpdateResolveImageChanged(t *testing.T) { }, }, nil }, - serviceUpdateFunc: func(serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) { + serviceUpdateFunc: func(serviceID string, version swarm.Version, service swarm.ServiceSpec, options swarm.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) { receivedOptions = options receivedService = service return swarm.ServiceUpdateResponse{}, nil @@ -105,7 +104,7 @@ func TestServiceUpdateResolveImageChanged(t *testing.T) { assert.Check(t, is.Equal(receivedService.TaskTemplate.ForceUpdate, tc.expectedForceUpdate)) receivedService = swarm.ServiceSpec{} - receivedOptions = types.ServiceUpdateOptions{} + receivedOptions = swarm.ServiceUpdateOptions{} }) } } diff --git a/cli/command/stack/swarm/list.go b/cli/command/stack/swarm/list.go index 4c58b3de93..ec951d71d3 100644 --- a/cli/command/stack/swarm/list.go +++ b/cli/command/stack/swarm/list.go @@ -5,7 +5,7 @@ import ( "github.com/docker/cli/cli/command/stack/formatter" "github.com/docker/cli/cli/compose/convert" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" "github.com/pkg/errors" ) @@ -14,7 +14,7 @@ import ( func GetStacks(ctx context.Context, apiClient client.ServiceAPIClient) ([]*formatter.Stack, error) { services, err := apiClient.ServiceList( ctx, - types.ServiceListOptions{Filters: getAllStacksFilter()}) + swarm.ServiceListOptions{Filters: getAllStacksFilter()}) if err != nil { return nil, err } diff --git a/cli/command/stack/swarm/ps.go b/cli/command/stack/swarm/ps.go index fe2839b065..d213d525d6 100644 --- a/cli/command/stack/swarm/ps.go +++ b/cli/command/stack/swarm/ps.go @@ -8,7 +8,7 @@ import ( "github.com/docker/cli/cli/command/idresolver" "github.com/docker/cli/cli/command/stack/options" "github.com/docker/cli/cli/command/task" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/swarm" ) // RunPS is the swarm implementation of docker stack ps @@ -16,7 +16,7 @@ func RunPS(ctx context.Context, dockerCli command.Cli, opts options.PS) error { filter := getStackFilterFromOpt(opts.Namespace, opts.Filter) client := dockerCli.Client() - tasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter}) + tasks, err := client.TaskList(ctx, swarm.TaskListOptions{Filters: filter}) if err != nil { return err } diff --git a/cli/command/stack/swarm/services.go b/cli/command/stack/swarm/services.go index dc4f8c87c4..e75d3ccf8c 100644 --- a/cli/command/stack/swarm/services.go +++ b/cli/command/stack/swarm/services.go @@ -6,7 +6,6 @@ import ( "github.com/docker/cli/cli/command" "github.com/docker/cli/cli/command/service" "github.com/docker/cli/cli/command/stack/options" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" ) @@ -17,7 +16,7 @@ func GetServices(ctx context.Context, dockerCli command.Cli, opts options.Servic client = dockerCli.Client() ) - listOpts := types.ServiceListOptions{ + listOpts := swarm.ServiceListOptions{ Filters: getStackFilterFromOpt(opts.Namespace, opts.Filter), // When not running "quiet", also get service status (number of running // and desired tasks). Note that this is only supported on API v1.41 and diff --git a/cli/command/swarm/client_test.go b/cli/command/swarm/client_test.go index 9e37db0e60..c712887018 100644 --- a/cli/command/swarm/client_test.go +++ b/cli/command/swarm/client_test.go @@ -3,7 +3,6 @@ package swarm import ( "context" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/system" "github.com/docker/docker/client" @@ -15,7 +14,7 @@ type fakeClient struct { swarmInitFunc func() (string, error) swarmInspectFunc func() (swarm.Swarm, error) nodeInspectFunc func() (swarm.Node, []byte, error) - swarmGetUnlockKeyFunc func() (types.SwarmUnlockKeyResponse, error) + swarmGetUnlockKeyFunc func() (swarm.UnlockKeyResponse, error) swarmJoinFunc func() error swarmLeaveFunc func() error swarmUpdateFunc func(swarm swarm.Spec, flags swarm.UpdateFlags) error @@ -50,11 +49,11 @@ func (cli *fakeClient) SwarmInspect(context.Context) (swarm.Swarm, error) { return swarm.Swarm{}, nil } -func (cli *fakeClient) SwarmGetUnlockKey(context.Context) (types.SwarmUnlockKeyResponse, error) { +func (cli *fakeClient) SwarmGetUnlockKey(context.Context) (swarm.UnlockKeyResponse, error) { if cli.swarmGetUnlockKeyFunc != nil { return cli.swarmGetUnlockKeyFunc() } - return types.SwarmUnlockKeyResponse{}, nil + return swarm.UnlockKeyResponse{}, nil } func (cli *fakeClient) SwarmJoin(context.Context, swarm.JoinRequest) error { diff --git a/cli/command/swarm/init_test.go b/cli/command/swarm/init_test.go index f76ae79c66..1ed5cfb9b8 100644 --- a/cli/command/swarm/init_test.go +++ b/cli/command/swarm/init_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "gotest.tools/v3/assert" "gotest.tools/v3/golden" @@ -19,7 +18,7 @@ func TestSwarmInitErrorOnAPIFailure(t *testing.T) { flags map[string]string swarmInitFunc func() (string, error) swarmInspectFunc func() (swarm.Swarm, error) - swarmGetUnlockKeyFunc func() (types.SwarmUnlockKeyResponse, error) + swarmGetUnlockKeyFunc func() (swarm.UnlockKeyResponse, error) nodeInspectFunc func() (swarm.Node, []byte, error) expectedError string }{ @@ -56,8 +55,8 @@ func TestSwarmInitErrorOnAPIFailure(t *testing.T) { flags: map[string]string{ flagAutolock: "true", }, - swarmGetUnlockKeyFunc: func() (types.SwarmUnlockKeyResponse, error) { - return types.SwarmUnlockKeyResponse{}, errors.New("error getting swarm unlock key") + swarmGetUnlockKeyFunc: func() (swarm.UnlockKeyResponse, error) { + return swarm.UnlockKeyResponse{}, errors.New("error getting swarm unlock key") }, expectedError: "could not fetch unlock key: error getting swarm unlock key", }, @@ -88,7 +87,7 @@ func TestSwarmInit(t *testing.T) { flags map[string]string swarmInitFunc func() (string, error) swarmInspectFunc func() (swarm.Swarm, error) - swarmGetUnlockKeyFunc func() (types.SwarmUnlockKeyResponse, error) + swarmGetUnlockKeyFunc func() (swarm.UnlockKeyResponse, error) nodeInspectFunc func() (swarm.Node, []byte, error) }{ { @@ -105,8 +104,8 @@ func TestSwarmInit(t *testing.T) { swarmInitFunc: func() (string, error) { return "nodeID", nil }, - swarmGetUnlockKeyFunc: func() (types.SwarmUnlockKeyResponse, error) { - return types.SwarmUnlockKeyResponse{ + swarmGetUnlockKeyFunc: func() (swarm.UnlockKeyResponse, error) { + return swarm.UnlockKeyResponse{ UnlockKey: "unlock-key", }, nil }, diff --git a/cli/command/swarm/progress/root_rotation.go b/cli/command/swarm/progress/root_rotation.go index e72de1d2d7..007418d346 100644 --- a/cli/command/swarm/progress/root_rotation.go +++ b/cli/command/swarm/progress/root_rotation.go @@ -8,7 +8,6 @@ import ( "os/signal" "time" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" "github.com/docker/docker/pkg/progress" @@ -52,7 +51,7 @@ func RootRotationProgress(ctx context.Context, dclient client.APIClient, progres return nil } - nodes, err := dclient.NodeList(ctx, types.NodeListOptions{}) + nodes, err := dclient.NodeList(ctx, swarm.NodeListOptions{}) if err != nil { return err } diff --git a/cli/command/swarm/unlock_key_test.go b/cli/command/swarm/unlock_key_test.go index 05bd220d43..ec80727dd6 100644 --- a/cli/command/swarm/unlock_key_test.go +++ b/cli/command/swarm/unlock_key_test.go @@ -8,7 +8,6 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test/builders" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "gotest.tools/v3/assert" "gotest.tools/v3/golden" @@ -21,7 +20,7 @@ func TestSwarmUnlockKeyErrors(t *testing.T) { flags map[string]string swarmInspectFunc func() (swarm.Swarm, error) swarmUpdateFunc func(swarm swarm.Spec, flags swarm.UpdateFlags) error - swarmGetUnlockKeyFunc func() (types.SwarmUnlockKeyResponse, error) + swarmGetUnlockKeyFunc func() (swarm.UnlockKeyResponse, error) expectedError string }{ { @@ -64,17 +63,15 @@ func TestSwarmUnlockKeyErrors(t *testing.T) { }, { name: "swarm-get-unlock-key-failed", - swarmGetUnlockKeyFunc: func() (types.SwarmUnlockKeyResponse, error) { - return types.SwarmUnlockKeyResponse{}, errors.New("error getting unlock key") + swarmGetUnlockKeyFunc: func() (swarm.UnlockKeyResponse, error) { + return swarm.UnlockKeyResponse{}, errors.New("error getting unlock key") }, expectedError: "error getting unlock key", }, { name: "swarm-no-unlock-key-failed", - swarmGetUnlockKeyFunc: func() (types.SwarmUnlockKeyResponse, error) { - return types.SwarmUnlockKeyResponse{ - UnlockKey: "", - }, nil + swarmGetUnlockKeyFunc: func() (swarm.UnlockKeyResponse, error) { + return swarm.UnlockKeyResponse{}, nil }, expectedError: "no unlock key is set", }, @@ -108,12 +105,12 @@ func TestSwarmUnlockKey(t *testing.T) { flags map[string]string swarmInspectFunc func() (swarm.Swarm, error) swarmUpdateFunc func(swarm swarm.Spec, flags swarm.UpdateFlags) error - swarmGetUnlockKeyFunc func() (types.SwarmUnlockKeyResponse, error) + swarmGetUnlockKeyFunc func() (swarm.UnlockKeyResponse, error) }{ { name: "unlock-key", - swarmGetUnlockKeyFunc: func() (types.SwarmUnlockKeyResponse, error) { - return types.SwarmUnlockKeyResponse{ + swarmGetUnlockKeyFunc: func() (swarm.UnlockKeyResponse, error) { + return swarm.UnlockKeyResponse{ UnlockKey: "unlock-key", }, nil }, @@ -123,8 +120,8 @@ func TestSwarmUnlockKey(t *testing.T) { flags: map[string]string{ flagQuiet: "true", }, - swarmGetUnlockKeyFunc: func() (types.SwarmUnlockKeyResponse, error) { - return types.SwarmUnlockKeyResponse{ + swarmGetUnlockKeyFunc: func() (swarm.UnlockKeyResponse, error) { + return swarm.UnlockKeyResponse{ UnlockKey: "unlock-key", }, nil }, @@ -137,8 +134,8 @@ func TestSwarmUnlockKey(t *testing.T) { swarmInspectFunc: func() (swarm.Swarm, error) { return *builders.Swarm(builders.Autolock()), nil }, - swarmGetUnlockKeyFunc: func() (types.SwarmUnlockKeyResponse, error) { - return types.SwarmUnlockKeyResponse{ + swarmGetUnlockKeyFunc: func() (swarm.UnlockKeyResponse, error) { + return swarm.UnlockKeyResponse{ UnlockKey: "unlock-key", }, nil }, @@ -152,8 +149,8 @@ func TestSwarmUnlockKey(t *testing.T) { swarmInspectFunc: func() (swarm.Swarm, error) { return *builders.Swarm(builders.Autolock()), nil }, - swarmGetUnlockKeyFunc: func() (types.SwarmUnlockKeyResponse, error) { - return types.SwarmUnlockKeyResponse{ + swarmGetUnlockKeyFunc: func() (swarm.UnlockKeyResponse, error) { + return swarm.UnlockKeyResponse{ UnlockKey: "unlock-key", }, nil }, diff --git a/cli/command/swarm/update_test.go b/cli/command/swarm/update_test.go index d6246de810..373c2712bc 100644 --- a/cli/command/swarm/update_test.go +++ b/cli/command/swarm/update_test.go @@ -9,7 +9,6 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test/builders" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "gotest.tools/v3/assert" "gotest.tools/v3/golden" @@ -22,7 +21,7 @@ func TestSwarmUpdateErrors(t *testing.T) { flags map[string]string swarmInspectFunc func() (swarm.Swarm, error) swarmUpdateFunc func(swarm swarm.Spec, flags swarm.UpdateFlags) error - swarmGetUnlockKeyFunc func() (types.SwarmUnlockKeyResponse, error) + swarmGetUnlockKeyFunc func() (swarm.UnlockKeyResponse, error) expectedError string }{ { @@ -58,8 +57,8 @@ func TestSwarmUpdateErrors(t *testing.T) { swarmInspectFunc: func() (swarm.Swarm, error) { return *builders.Swarm(), nil }, - swarmGetUnlockKeyFunc: func() (types.SwarmUnlockKeyResponse, error) { - return types.SwarmUnlockKeyResponse{}, errors.New("error getting unlock key") + swarmGetUnlockKeyFunc: func() (swarm.UnlockKeyResponse, error) { + return swarm.UnlockKeyResponse{}, errors.New("error getting unlock key") }, expectedError: "error getting unlock key", }, @@ -97,7 +96,7 @@ func TestSwarmUpdate(t *testing.T) { flags map[string]string swarmInspectFunc func() (swarm.Swarm, error) swarmUpdateFunc func(swarm swarm.Spec, flags swarm.UpdateFlags) error - swarmGetUnlockKeyFunc func() (types.SwarmUnlockKeyResponse, error) + swarmGetUnlockKeyFunc func() (swarm.UnlockKeyResponse, error) }{ { name: "noargs", @@ -164,8 +163,8 @@ func TestSwarmUpdate(t *testing.T) { swarmInspectFunc: func() (swarm.Swarm, error) { return *builders.Swarm(), nil }, - swarmGetUnlockKeyFunc: func() (types.SwarmUnlockKeyResponse, error) { - return types.SwarmUnlockKeyResponse{ + swarmGetUnlockKeyFunc: func() (swarm.UnlockKeyResponse, error) { + return swarm.UnlockKeyResponse{ UnlockKey: "unlock-key", }, nil }, diff --git a/cli/command/system/client_test.go b/cli/command/system/client_test.go index 10334f8089..d188ea9f93 100644 --- a/cli/command/system/client_test.go +++ b/cli/command/system/client_test.go @@ -26,7 +26,7 @@ type fakeClient struct { infoFunc func(ctx context.Context) (system.Info, error) networkListFunc func(ctx context.Context, options network.ListOptions) ([]network.Summary, error) networkPruneFunc func(ctx context.Context, pruneFilter filters.Args) (network.PruneReport, error) - nodeListFunc func(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error) + nodeListFunc func(ctx context.Context, options swarm.NodeListOptions) ([]swarm.Node, error) serverVersion func(ctx context.Context) (types.Version, error) volumeListFunc func(ctx context.Context, options volume.ListOptions) (volume.ListResponse, error) } @@ -81,7 +81,7 @@ func (cli *fakeClient) NetworksPrune(ctx context.Context, pruneFilter filters.Ar return network.PruneReport{}, nil } -func (cli *fakeClient) NodeList(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error) { +func (cli *fakeClient) NodeList(ctx context.Context, options swarm.NodeListOptions) ([]swarm.Node, error) { if cli.nodeListFunc != nil { return cli.nodeListFunc(ctx, options) } diff --git a/cli/command/system/completion.go b/cli/command/system/completion.go index fad57b67f2..0b96e1157e 100644 --- a/cli/command/system/completion.go +++ b/cli/command/system/completion.go @@ -4,10 +4,10 @@ import ( "strings" "github.com/docker/cli/cli/command/completion" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/events" "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/network" + "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/volume" "github.com/spf13/cobra" ) @@ -211,7 +211,7 @@ func networkNames(dockerCLI completion.APIClientProvider, cmd *cobra.Command) [] // nodeNames contacts the API to get a list of node names. // In case of an error, an empty list is returned. func nodeNames(dockerCLI completion.APIClientProvider, cmd *cobra.Command) []string { - list, err := dockerCLI.Client().NodeList(cmd.Context(), types.NodeListOptions{}) + list, err := dockerCLI.Client().NodeList(cmd.Context(), swarm.NodeListOptions{}) if err != nil { return []string{} } diff --git a/cli/command/system/completion_test.go b/cli/command/system/completion_test.go index e3961f4661..3e703a6a49 100644 --- a/cli/command/system/completion_test.go +++ b/cli/command/system/completion_test.go @@ -8,7 +8,6 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test/builders" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/network" @@ -111,7 +110,7 @@ func TestCompleteEventFilter(t *testing.T) { }, { client: &fakeClient{ - nodeListFunc: func(_ context.Context, _ types.NodeListOptions) ([]swarm.Node, error) { + nodeListFunc: func(_ context.Context, _ swarm.NodeListOptions) ([]swarm.Node, error) { return []swarm.Node{ *builders.Node(builders.Hostname("n1")), }, nil @@ -122,7 +121,7 @@ func TestCompleteEventFilter(t *testing.T) { }, { client: &fakeClient{ - nodeListFunc: func(_ context.Context, _ types.NodeListOptions) ([]swarm.Node, error) { + nodeListFunc: func(_ context.Context, _ swarm.NodeListOptions) ([]swarm.Node, error) { return []swarm.Node{}, errors.New("API error") }, }, diff --git a/cli/command/system/inspect.go b/cli/command/system/inspect.go index f5340fb01e..0afe65e411 100644 --- a/cli/command/system/inspect.go +++ b/cli/command/system/inspect.go @@ -15,9 +15,9 @@ import ( "github.com/docker/cli/cli/command/completion" "github.com/docker/cli/cli/command/inspect" flagsHelper "github.com/docker/cli/cli/flags" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/network" + "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -137,7 +137,7 @@ func inspectNode(ctx context.Context, dockerCli command.Cli) inspect.GetRefFunc func inspectService(ctx context.Context, dockerCli command.Cli) inspect.GetRefFunc { return func(ref string) (any, []byte, error) { // Service inspect shows defaults values in empty fields. - return dockerCli.Client().ServiceInspectWithRaw(ctx, ref, types.ServiceInspectOptions{InsertDefaults: true}) + return dockerCli.Client().ServiceInspectWithRaw(ctx, ref, swarm.ServiceInspectOptions{InsertDefaults: true}) } } diff --git a/cli/command/task/client_test.go b/cli/command/task/client_test.go index 3c5129e261..fa178898e2 100644 --- a/cli/command/task/client_test.go +++ b/cli/command/task/client_test.go @@ -3,7 +3,6 @@ package task import ( "context" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/client" ) @@ -11,7 +10,7 @@ import ( type fakeClient struct { client.APIClient nodeInspectWithRaw func(ref string) (swarm.Node, []byte, error) - serviceInspectWithRaw func(ref string, options types.ServiceInspectOptions) (swarm.Service, []byte, error) + serviceInspectWithRaw func(ref string, options swarm.ServiceInspectOptions) (swarm.Service, []byte, error) } func (cli *fakeClient) NodeInspectWithRaw(_ context.Context, ref string) (swarm.Node, []byte, error) { @@ -21,7 +20,7 @@ func (cli *fakeClient) NodeInspectWithRaw(_ context.Context, ref string) (swarm. return swarm.Node{}, nil, nil } -func (cli *fakeClient) ServiceInspectWithRaw(_ context.Context, ref string, options types.ServiceInspectOptions) (swarm.Service, []byte, error) { +func (cli *fakeClient) ServiceInspectWithRaw(_ context.Context, ref string, options swarm.ServiceInspectOptions) (swarm.Service, []byte, error) { if cli.serviceInspectWithRaw != nil { return cli.serviceInspectWithRaw(ref, options) } diff --git a/cli/command/task/print_test.go b/cli/command/task/print_test.go index b549f67826..64160ac900 100644 --- a/cli/command/task/print_test.go +++ b/cli/command/task/print_test.go @@ -9,7 +9,6 @@ import ( "github.com/docker/cli/cli/command/idresolver" "github.com/docker/cli/internal/test" "github.com/docker/cli/internal/test/builders" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "gotest.tools/v3/assert" "gotest.tools/v3/golden" @@ -17,7 +16,7 @@ import ( func TestTaskPrintSorted(t *testing.T) { apiClient := &fakeClient{ - serviceInspectWithRaw: func(ref string, options types.ServiceInspectOptions) (swarm.Service, []byte, error) { + serviceInspectWithRaw: func(ref string, options swarm.ServiceInspectOptions) (swarm.Service, []byte, error) { if ref == "service-id-one" { return *builders.Service(builders.ServiceName("service-name-1")), nil, nil } @@ -109,7 +108,7 @@ func TestTaskPrintWithIndentation(t *testing.T) { const trunc = false const noResolve = false apiClient := &fakeClient{ - serviceInspectWithRaw: func(ref string, options types.ServiceInspectOptions) (swarm.Service, []byte, error) { + serviceInspectWithRaw: func(ref string, options swarm.ServiceInspectOptions) (swarm.Service, []byte, error) { return *builders.Service(builders.ServiceName("service-name-foo")), nil, nil }, nodeInspectWithRaw: func(ref string) (swarm.Node, []byte, error) { @@ -145,7 +144,7 @@ func TestTaskPrintWithResolution(t *testing.T) { const trunc = false const noResolve = false apiClient := &fakeClient{ - serviceInspectWithRaw: func(ref string, options types.ServiceInspectOptions) (swarm.Service, []byte, error) { + serviceInspectWithRaw: func(ref string, options swarm.ServiceInspectOptions) (swarm.Service, []byte, error) { return *builders.Service(builders.ServiceName("service-name-foo")), nil, nil }, nodeInspectWithRaw: func(ref string) (swarm.Node, []byte, error) { diff --git a/vendor.mod b/vendor.mod index 2f070632bf..6f1ae78fe5 100644 --- a/vendor.mod +++ b/vendor.mod @@ -15,7 +15,7 @@ require ( github.com/distribution/reference v0.6.0 github.com/docker/cli-docs-tool v0.9.0 github.com/docker/distribution v2.8.3+incompatible - github.com/docker/docker v28.2.0-rc.1+incompatible + github.com/docker/docker v28.2.0-rc.1.0.20250519201520-8601b22f5db5+incompatible // master, v28.2-dev github.com/docker/docker-credential-helpers v0.9.3 github.com/docker/go-connections v0.5.0 github.com/docker/go-units v0.5.0 diff --git a/vendor.sum b/vendor.sum index c73b4124ab..9beeb7fd84 100644 --- a/vendor.sum +++ b/vendor.sum @@ -55,8 +55,8 @@ github.com/docker/cli-docs-tool v0.9.0/go.mod h1:ClrwlNW+UioiRyH9GiAOe1o3J/TsY3T github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v28.2.0-rc.1+incompatible h1:wkPZ0yYhwfXHxnIXOXwgOsBVSwTUUbQ3nBYGC7L6sl8= -github.com/docker/docker v28.2.0-rc.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v28.2.0-rc.1.0.20250519201520-8601b22f5db5+incompatible h1:lRjUQk5O0hf8SBkjc9KNTePPhldGmNmVA+ykOS6Pg4A= +github.com/docker/docker v28.2.0-rc.1.0.20250519201520-8601b22f5db5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.9.3 h1:gAm/VtF9wgqJMoxzT3Gj5p4AqIjCBS4wrsOh9yRqcz8= github.com/docker/docker-credential-helpers v0.9.3/go.mod h1:x+4Gbw9aGmChi3qTLZj8Dfn0TD20M/fuWy0E5+WDeCo= github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0= diff --git a/vendor/github.com/docker/docker/api/types/client.go b/vendor/github.com/docker/docker/api/types/client.go index b182c060cf..a3704edd34 100644 --- a/vendor/github.com/docker/docker/api/types/client.go +++ b/vendor/github.com/docker/docker/api/types/client.go @@ -4,8 +4,6 @@ import ( "bufio" "context" "net" - - "github.com/docker/docker/api/types/filters" ) // NewHijackedResponse initializes a [HijackedResponse] type. @@ -48,87 +46,6 @@ func (h *HijackedResponse) CloseWrite() error { return nil } -// NodeListOptions holds parameters to list nodes with. -type NodeListOptions struct { - Filters filters.Args -} - -// NodeRemoveOptions holds parameters to remove nodes with. -type NodeRemoveOptions struct { - Force bool -} - -// ServiceCreateOptions contains the options to use when creating a service. -type ServiceCreateOptions struct { - // EncodedRegistryAuth is the encoded registry authorization credentials to - // use when updating the service. - // - // This field follows the format of the X-Registry-Auth header. - EncodedRegistryAuth string - - // QueryRegistry indicates whether the service update requires - // contacting a registry. A registry may be contacted to retrieve - // the image digest and manifest, which in turn can be used to update - // platform or other information about the service. - QueryRegistry bool -} - -// Values for RegistryAuthFrom in ServiceUpdateOptions -const ( - RegistryAuthFromSpec = "spec" - RegistryAuthFromPreviousSpec = "previous-spec" -) - -// ServiceUpdateOptions contains the options to be used for updating services. -type ServiceUpdateOptions struct { - // EncodedRegistryAuth is the encoded registry authorization credentials to - // use when updating the service. - // - // This field follows the format of the X-Registry-Auth header. - EncodedRegistryAuth string - - // TODO(stevvooe): Consider moving the version parameter of ServiceUpdate - // into this field. While it does open API users up to racy writes, most - // users may not need that level of consistency in practice. - - // RegistryAuthFrom specifies where to find the registry authorization - // credentials if they are not given in EncodedRegistryAuth. Valid - // values are "spec" and "previous-spec". - RegistryAuthFrom string - - // Rollback indicates whether a server-side rollback should be - // performed. When this is set, the provided spec will be ignored. - // The valid values are "previous" and "none". An empty value is the - // same as "none". - Rollback string - - // QueryRegistry indicates whether the service update requires - // contacting a registry. A registry may be contacted to retrieve - // the image digest and manifest, which in turn can be used to update - // platform or other information about the service. - QueryRegistry bool -} - -// ServiceListOptions holds parameters to list services with. -type ServiceListOptions struct { - Filters filters.Args - - // Status indicates whether the server should include the service task - // count of running and desired tasks. - Status bool -} - -// ServiceInspectOptions holds parameters related to the "service inspect" -// operation. -type ServiceInspectOptions struct { - InsertDefaults bool -} - -// TaskListOptions holds parameters to list tasks with. -type TaskListOptions struct { - Filters filters.Args -} - // PluginRemoveOptions holds parameters to remove plugins. type PluginRemoveOptions struct { Force bool @@ -162,13 +79,6 @@ type PluginInstallOptions struct { Args []string } -// SwarmUnlockKeyResponse contains the response for Engine API: -// GET /swarm/unlockkey -type SwarmUnlockKeyResponse struct { - // UnlockKey is the unlock key in ASCII-armored format. - UnlockKey string -} - // PluginCreateOptions hold all options to plugin create. type PluginCreateOptions struct { RepoName string diff --git a/vendor/github.com/docker/docker/api/types/swarm/node.go b/vendor/github.com/docker/docker/api/types/swarm/node.go index bb98d5eedc..f175b1b2c6 100644 --- a/vendor/github.com/docker/docker/api/types/swarm/node.go +++ b/vendor/github.com/docker/docker/api/types/swarm/node.go @@ -1,4 +1,5 @@ package swarm // import "github.com/docker/docker/api/types/swarm" +import "github.com/docker/docker/api/types/filters" // Node represents a node. type Node struct { @@ -137,3 +138,13 @@ const ( type Topology struct { Segments map[string]string `json:",omitempty"` } + +// NodeListOptions holds parameters to list nodes with. +type NodeListOptions struct { + Filters filters.Args +} + +// NodeRemoveOptions holds parameters to remove nodes with. +type NodeRemoveOptions struct { + Force bool +} diff --git a/vendor/github.com/docker/docker/api/types/swarm/service.go b/vendor/github.com/docker/docker/api/types/swarm/service.go index 5b6d5ec120..1d0a9a47bc 100644 --- a/vendor/github.com/docker/docker/api/types/swarm/service.go +++ b/vendor/github.com/docker/docker/api/types/swarm/service.go @@ -1,6 +1,10 @@ package swarm // import "github.com/docker/docker/api/types/swarm" -import "time" +import ( + "time" + + "github.com/docker/docker/api/types/filters" +) // Service represents a service. type Service struct { @@ -200,3 +204,69 @@ type JobStatus struct { // Swarm manager. LastExecution time.Time `json:",omitempty"` } + +// ServiceCreateOptions contains the options to use when creating a service. +type ServiceCreateOptions struct { + // EncodedRegistryAuth is the encoded registry authorization credentials to + // use when updating the service. + // + // This field follows the format of the X-Registry-Auth header. + EncodedRegistryAuth string + + // QueryRegistry indicates whether the service update requires + // contacting a registry. A registry may be contacted to retrieve + // the image digest and manifest, which in turn can be used to update + // platform or other information about the service. + QueryRegistry bool +} + +// Values for RegistryAuthFrom in ServiceUpdateOptions +const ( + RegistryAuthFromSpec = "spec" + RegistryAuthFromPreviousSpec = "previous-spec" +) + +// ServiceUpdateOptions contains the options to be used for updating services. +type ServiceUpdateOptions struct { + // EncodedRegistryAuth is the encoded registry authorization credentials to + // use when updating the service. + // + // This field follows the format of the X-Registry-Auth header. + EncodedRegistryAuth string + + // TODO(stevvooe): Consider moving the version parameter of ServiceUpdate + // into this field. While it does open API users up to racy writes, most + // users may not need that level of consistency in practice. + + // RegistryAuthFrom specifies where to find the registry authorization + // credentials if they are not given in EncodedRegistryAuth. Valid + // values are "spec" and "previous-spec". + RegistryAuthFrom string + + // Rollback indicates whether a server-side rollback should be + // performed. When this is set, the provided spec will be ignored. + // The valid values are "previous" and "none". An empty value is the + // same as "none". + Rollback string + + // QueryRegistry indicates whether the service update requires + // contacting a registry. A registry may be contacted to retrieve + // the image digest and manifest, which in turn can be used to update + // platform or other information about the service. + QueryRegistry bool +} + +// ServiceListOptions holds parameters to list services with. +type ServiceListOptions struct { + Filters filters.Args + + // Status indicates whether the server should include the service task + // count of running and desired tasks. + Status bool +} + +// ServiceInspectOptions holds parameters related to the "service inspect" +// operation. +type ServiceInspectOptions struct { + InsertDefaults bool +} diff --git a/vendor/github.com/docker/docker/api/types/swarm/swarm.go b/vendor/github.com/docker/docker/api/types/swarm/swarm.go index 1b4be6fffb..2711c9eac5 100644 --- a/vendor/github.com/docker/docker/api/types/swarm/swarm.go +++ b/vendor/github.com/docker/docker/api/types/swarm/swarm.go @@ -235,3 +235,10 @@ type UpdateFlags struct { RotateManagerToken bool RotateManagerUnlockKey bool } + +// UnlockKeyResponse contains the response for Engine API: +// GET /swarm/unlockkey +type UnlockKeyResponse struct { + // UnlockKey is the unlock key in ASCII-armored format. + UnlockKey string +} diff --git a/vendor/github.com/docker/docker/api/types/swarm/task.go b/vendor/github.com/docker/docker/api/types/swarm/task.go index ad3eeca0b7..722d1ceb62 100644 --- a/vendor/github.com/docker/docker/api/types/swarm/task.go +++ b/vendor/github.com/docker/docker/api/types/swarm/task.go @@ -3,6 +3,7 @@ package swarm // import "github.com/docker/docker/api/types/swarm" import ( "time" + "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/swarm/runtime" ) @@ -223,3 +224,8 @@ type VolumeAttachment struct { // in the ContainerSpec, that this volume fulfills. Target string `json:",omitempty"` } + +// TaskListOptions holds parameters to list tasks with. +type TaskListOptions struct { + Filters filters.Args +} diff --git a/vendor/github.com/docker/docker/api/types/types_deprecated.go b/vendor/github.com/docker/docker/api/types/types_deprecated.go index 6d2a782adc..8456a45607 100644 --- a/vendor/github.com/docker/docker/api/types/types_deprecated.go +++ b/vendor/github.com/docker/docker/api/types/types_deprecated.go @@ -138,6 +138,53 @@ type ConfigCreateResponse = swarm.ConfigCreateResponse // Deprecated: use [swarm.ConfigListOptions]. type ConfigListOptions = swarm.ConfigListOptions +// NodeListOptions holds parameters to list nodes with. +// +// Deprecated: use [swarm.NodeListOptions]. +type NodeListOptions = swarm.NodeListOptions + +// NodeRemoveOptions holds parameters to remove nodes with. +// +// Deprecated: use [swarm.NodeRemoveOptions]. +type NodeRemoveOptions = swarm.NodeRemoveOptions + +// TaskListOptions holds parameters to list tasks with. +// +// Deprecated: use [swarm.TaskListOptions]. +type TaskListOptions = swarm.TaskListOptions + +// ServiceCreateOptions contains the options to use when creating a service. +// +// Deprecated: use [swarm.ServiceCreateOptions]. +type ServiceCreateOptions = swarm.ServiceCreateOptions + +// ServiceUpdateOptions contains the options to be used for updating services. +// +// Deprecated: use [swarm.ServiceCreateOptions]. +type ServiceUpdateOptions = swarm.ServiceUpdateOptions + +const ( + RegistryAuthFromSpec = swarm.RegistryAuthFromSpec // Deprecated: use [swarm.RegistryAuthFromSpec]. + RegistryAuthFromPreviousSpec = swarm.RegistryAuthFromPreviousSpec // Deprecated: use [swarm.RegistryAuthFromPreviousSpec]. +) + +// ServiceListOptions holds parameters to list services with. +// +// Deprecated: use [swarm.ServiceListOptions]. +type ServiceListOptions = swarm.ServiceListOptions + +// ServiceInspectOptions holds parameters related to the "service inspect" +// operation. +// +// Deprecated: use [swarm.ServiceInspectOptions]. +type ServiceInspectOptions = swarm.ServiceInspectOptions + +// SwarmUnlockKeyResponse contains the response for Engine API: +// GET /swarm/unlockkey +// +// Deprecated: use [swarm.UnlockKeyResponse]. +type SwarmUnlockKeyResponse = swarm.UnlockKeyResponse + // BuildCache contains information about a build cache record. // // Deprecated: deprecated in API 1.49. Use [build.CacheRecord] instead. diff --git a/vendor/github.com/docker/docker/client/client_interfaces.go b/vendor/github.com/docker/docker/client/client_interfaces.go index bc25c28b6a..fe4b1af9b0 100644 --- a/vendor/github.com/docker/docker/client/client_interfaces.go +++ b/vendor/github.com/docker/docker/client/client_interfaces.go @@ -155,8 +155,8 @@ type NetworkAPIClient interface { // NodeAPIClient defines API client methods for the nodes type NodeAPIClient interface { NodeInspectWithRaw(ctx context.Context, nodeID string) (swarm.Node, []byte, error) - NodeList(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error) - NodeRemove(ctx context.Context, nodeID string, options types.NodeRemoveOptions) error + NodeList(ctx context.Context, options swarm.NodeListOptions) ([]swarm.Node, error) + NodeRemove(ctx context.Context, nodeID string, options swarm.NodeRemoveOptions) error NodeUpdate(ctx context.Context, nodeID string, version swarm.Version, node swarm.NodeSpec) error } @@ -176,22 +176,22 @@ type PluginAPIClient interface { // ServiceAPIClient defines API client methods for the services type ServiceAPIClient interface { - ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (swarm.ServiceCreateResponse, error) - ServiceInspectWithRaw(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error) - ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) + ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options swarm.ServiceCreateOptions) (swarm.ServiceCreateResponse, error) + ServiceInspectWithRaw(ctx context.Context, serviceID string, options swarm.ServiceInspectOptions) (swarm.Service, []byte, error) + ServiceList(ctx context.Context, options swarm.ServiceListOptions) ([]swarm.Service, error) ServiceRemove(ctx context.Context, serviceID string) error - ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) + ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options swarm.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) ServiceLogs(ctx context.Context, serviceID string, options container.LogsOptions) (io.ReadCloser, error) TaskLogs(ctx context.Context, taskID string, options container.LogsOptions) (io.ReadCloser, error) TaskInspectWithRaw(ctx context.Context, taskID string) (swarm.Task, []byte, error) - TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error) + TaskList(ctx context.Context, options swarm.TaskListOptions) ([]swarm.Task, error) } // SwarmAPIClient defines API client methods for the swarm type SwarmAPIClient interface { SwarmInit(ctx context.Context, req swarm.InitRequest) (string, error) SwarmJoin(ctx context.Context, req swarm.JoinRequest) error - SwarmGetUnlockKey(ctx context.Context) (types.SwarmUnlockKeyResponse, error) + SwarmGetUnlockKey(ctx context.Context) (swarm.UnlockKeyResponse, error) SwarmUnlock(ctx context.Context, req swarm.UnlockRequest) error SwarmLeave(ctx context.Context, force bool) error SwarmInspect(ctx context.Context) (swarm.Swarm, error) diff --git a/vendor/github.com/docker/docker/client/image_pull.go b/vendor/github.com/docker/docker/client/image_pull.go index f5fe85dd47..ae8c807f77 100644 --- a/vendor/github.com/docker/docker/client/image_pull.go +++ b/vendor/github.com/docker/docker/client/image_pull.go @@ -6,9 +6,9 @@ import ( "net/url" "strings" + cerrdefs "github.com/containerd/errdefs" "github.com/distribution/reference" "github.com/docker/docker/api/types/image" - "github.com/docker/docker/errdefs" ) // ImagePull requests the docker host to pull an image from a remote registry. @@ -35,7 +35,7 @@ func (cli *Client) ImagePull(ctx context.Context, refStr string, options image.P } resp, err := cli.tryImageCreate(ctx, query, options.RegistryAuth) - if errdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil { + if cerrdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil { newAuthHeader, privilegeErr := options.PrivilegeFunc(ctx) if privilegeErr != nil { return nil, privilegeErr diff --git a/vendor/github.com/docker/docker/client/image_push.go b/vendor/github.com/docker/docker/client/image_push.go index 1a343f43f1..5210304403 100644 --- a/vendor/github.com/docker/docker/client/image_push.go +++ b/vendor/github.com/docker/docker/client/image_push.go @@ -9,10 +9,10 @@ import ( "net/http" "net/url" + cerrdefs "github.com/containerd/errdefs" "github.com/distribution/reference" "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/registry" - "github.com/docker/docker/errdefs" ) // ImagePush requests the docker host to push an image to a remote registry. @@ -52,7 +52,7 @@ func (cli *Client) ImagePush(ctx context.Context, image string, options image.Pu } resp, err := cli.tryImagePush(ctx, ref.Name(), query, options.RegistryAuth) - if errdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil { + if cerrdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil { newAuthHeader, privilegeErr := options.PrivilegeFunc(ctx) if privilegeErr != nil { return nil, privilegeErr diff --git a/vendor/github.com/docker/docker/client/image_search.go b/vendor/github.com/docker/docker/client/image_search.go index 0a7b5ec226..f3aab43a80 100644 --- a/vendor/github.com/docker/docker/client/image_search.go +++ b/vendor/github.com/docker/docker/client/image_search.go @@ -7,9 +7,9 @@ import ( "net/url" "strconv" + cerrdefs "github.com/containerd/errdefs" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/registry" - "github.com/docker/docker/errdefs" ) // ImageSearch makes the docker host search by a term in a remote registry. @@ -32,7 +32,7 @@ func (cli *Client) ImageSearch(ctx context.Context, term string, options registr resp, err := cli.tryImageSearch(ctx, query, options.RegistryAuth) defer ensureReaderClosed(resp) - if errdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil { + if cerrdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil { newAuthHeader, privilegeErr := options.PrivilegeFunc(ctx) if privilegeErr != nil { return results, privilegeErr diff --git a/vendor/github.com/docker/docker/client/node_list.go b/vendor/github.com/docker/docker/client/node_list.go index 2534f4aee1..429eec2443 100644 --- a/vendor/github.com/docker/docker/client/node_list.go +++ b/vendor/github.com/docker/docker/client/node_list.go @@ -5,13 +5,12 @@ import ( "encoding/json" "net/url" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/swarm" ) // NodeList returns the list of nodes. -func (cli *Client) NodeList(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error) { +func (cli *Client) NodeList(ctx context.Context, options swarm.NodeListOptions) ([]swarm.Node, error) { query := url.Values{} if options.Filters.Len() > 0 { diff --git a/vendor/github.com/docker/docker/client/node_remove.go b/vendor/github.com/docker/docker/client/node_remove.go index 81f8fed6b5..07d8e65364 100644 --- a/vendor/github.com/docker/docker/client/node_remove.go +++ b/vendor/github.com/docker/docker/client/node_remove.go @@ -4,11 +4,11 @@ import ( "context" "net/url" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/swarm" ) // NodeRemove removes a Node. -func (cli *Client) NodeRemove(ctx context.Context, nodeID string, options types.NodeRemoveOptions) error { +func (cli *Client) NodeRemove(ctx context.Context, nodeID string, options swarm.NodeRemoveOptions) error { nodeID, err := trimID("node", nodeID) if err != nil { return err diff --git a/vendor/github.com/docker/docker/client/plugin_install.go b/vendor/github.com/docker/docker/client/plugin_install.go index 3d8615e8e4..8553961ba6 100644 --- a/vendor/github.com/docker/docker/client/plugin_install.go +++ b/vendor/github.com/docker/docker/client/plugin_install.go @@ -7,10 +7,10 @@ import ( "net/http" "net/url" + cerrdefs "github.com/containerd/errdefs" "github.com/distribution/reference" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/registry" - "github.com/docker/docker/errdefs" "github.com/pkg/errors" ) @@ -82,7 +82,7 @@ func (cli *Client) tryPluginPull(ctx context.Context, query url.Values, privileg func (cli *Client) checkPluginPermissions(ctx context.Context, query url.Values, options types.PluginInstallOptions) (types.PluginPrivileges, error) { resp, err := cli.tryPluginPrivileges(ctx, query, options.RegistryAuth) - if errdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil { + if cerrdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil { // todo: do inspect before to check existing name before checking privileges newAuthHeader, privilegeErr := options.PrivilegeFunc(ctx) if privilegeErr != nil { diff --git a/vendor/github.com/docker/docker/client/request.go b/vendor/github.com/docker/docker/client/request.go index dd95653a79..80e6d03a57 100644 --- a/vendor/github.com/docker/docker/client/request.go +++ b/vendor/github.com/docker/docker/client/request.go @@ -116,10 +116,8 @@ func (cli *Client) sendRequest(ctx context.Context, method, path string, query u resp, err := cli.doRequest(req) switch { - case errors.Is(err, context.Canceled): - return nil, errdefs.Cancelled(err) - case errors.Is(err, context.DeadlineExceeded): - return nil, errdefs.Deadline(err) + case errors.Is(err, context.Canceled), errors.Is(err, context.DeadlineExceeded): + return nil, err case err == nil: return resp, cli.checkResponseErr(resp) default: diff --git a/vendor/github.com/docker/docker/client/service_create.go b/vendor/github.com/docker/docker/client/service_create.go index 54c03b1389..6b9932ae2e 100644 --- a/vendor/github.com/docker/docker/client/service_create.go +++ b/vendor/github.com/docker/docker/client/service_create.go @@ -8,7 +8,6 @@ import ( "strings" "github.com/distribution/reference" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/registry" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/versions" @@ -17,7 +16,7 @@ import ( ) // ServiceCreate creates a new service. -func (cli *Client) ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options types.ServiceCreateOptions) (swarm.ServiceCreateResponse, error) { +func (cli *Client) ServiceCreate(ctx context.Context, service swarm.ServiceSpec, options swarm.ServiceCreateOptions) (swarm.ServiceCreateResponse, error) { var response swarm.ServiceCreateResponse // Make sure we negotiated (if the client is configured to do so), diff --git a/vendor/github.com/docker/docker/client/service_inspect.go b/vendor/github.com/docker/docker/client/service_inspect.go index 77b4402d37..892e9004fe 100644 --- a/vendor/github.com/docker/docker/client/service_inspect.go +++ b/vendor/github.com/docker/docker/client/service_inspect.go @@ -8,12 +8,11 @@ import ( "io" "net/url" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" ) // ServiceInspectWithRaw returns the service information and the raw data. -func (cli *Client) ServiceInspectWithRaw(ctx context.Context, serviceID string, opts types.ServiceInspectOptions) (swarm.Service, []byte, error) { +func (cli *Client) ServiceInspectWithRaw(ctx context.Context, serviceID string, opts swarm.ServiceInspectOptions) (swarm.Service, []byte, error) { serviceID, err := trimID("service", serviceID) if err != nil { return swarm.Service{}, nil, err diff --git a/vendor/github.com/docker/docker/client/service_list.go b/vendor/github.com/docker/docker/client/service_list.go index f589a8423a..019873bb6d 100644 --- a/vendor/github.com/docker/docker/client/service_list.go +++ b/vendor/github.com/docker/docker/client/service_list.go @@ -5,13 +5,12 @@ import ( "encoding/json" "net/url" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/swarm" ) // ServiceList returns the list of services. -func (cli *Client) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) { +func (cli *Client) ServiceList(ctx context.Context, options swarm.ServiceListOptions) ([]swarm.Service, error) { query := url.Values{} if options.Filters.Len() > 0 { diff --git a/vendor/github.com/docker/docker/client/service_update.go b/vendor/github.com/docker/docker/client/service_update.go index ecb98f4684..e0c1a26648 100644 --- a/vendor/github.com/docker/docker/client/service_update.go +++ b/vendor/github.com/docker/docker/client/service_update.go @@ -6,7 +6,6 @@ import ( "net/http" "net/url" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/registry" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/versions" @@ -15,7 +14,7 @@ import ( // ServiceUpdate updates a Service. The version number is required to avoid conflicting writes. // It should be the value as set *before* the update. You can find this value in the Meta field // of swarm.Service, which can be found using ServiceInspectWithRaw. -func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) { +func (cli *Client) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options swarm.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) { serviceID, err := trimID("service", serviceID) if err != nil { return swarm.ServiceUpdateResponse{}, err diff --git a/vendor/github.com/docker/docker/client/swarm_get_unlock_key.go b/vendor/github.com/docker/docker/client/swarm_get_unlock_key.go index 271fc08c95..6e30daf615 100644 --- a/vendor/github.com/docker/docker/client/swarm_get_unlock_key.go +++ b/vendor/github.com/docker/docker/client/swarm_get_unlock_key.go @@ -4,18 +4,18 @@ import ( "context" "encoding/json" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/swarm" ) // SwarmGetUnlockKey retrieves the swarm's unlock key. -func (cli *Client) SwarmGetUnlockKey(ctx context.Context) (types.SwarmUnlockKeyResponse, error) { +func (cli *Client) SwarmGetUnlockKey(ctx context.Context) (swarm.UnlockKeyResponse, error) { resp, err := cli.get(ctx, "/swarm/unlockkey", nil, nil) defer ensureReaderClosed(resp) if err != nil { - return types.SwarmUnlockKeyResponse{}, err + return swarm.UnlockKeyResponse{}, err } - var response types.SwarmUnlockKeyResponse + var response swarm.UnlockKeyResponse err = json.NewDecoder(resp.Body).Decode(&response) return response, err } diff --git a/vendor/github.com/docker/docker/client/task_list.go b/vendor/github.com/docker/docker/client/task_list.go index aba7f61e65..5d540c3832 100644 --- a/vendor/github.com/docker/docker/client/task_list.go +++ b/vendor/github.com/docker/docker/client/task_list.go @@ -5,13 +5,12 @@ import ( "encoding/json" "net/url" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/swarm" ) // TaskList returns the list of tasks. -func (cli *Client) TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error) { +func (cli *Client) TaskList(ctx context.Context, options swarm.TaskListOptions) ([]swarm.Task, error) { query := url.Values{} if options.Filters.Len() > 0 { diff --git a/vendor/github.com/docker/docker/client/utils.go b/vendor/github.com/docker/docker/client/utils.go index 925d4d8d38..27f2b9884b 100644 --- a/vendor/github.com/docker/docker/client/utils.go +++ b/vendor/github.com/docker/docker/client/utils.go @@ -6,8 +6,8 @@ import ( "net/url" "strings" + cerrdefs "github.com/containerd/errdefs" "github.com/docker/docker/api/types/filters" - "github.com/docker/docker/errdefs" "github.com/docker/docker/internal/lazyregexp" ocispec "github.com/opencontainers/image-spec/specs-go/v1" ) @@ -90,7 +90,7 @@ func encodePlatforms(platform ...ocispec.Platform) ([]string, error) { func encodePlatform(platform *ocispec.Platform) (string, error) { p, err := json.Marshal(platform) if err != nil { - return "", errdefs.InvalidParameter(fmt.Errorf("invalid platform: %v", err)) + return "", fmt.Errorf("%w: invalid platform: %v", cerrdefs.ErrInvalidArgument, err) } return string(p), nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index d0dd180357..83dbaa3e41 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -61,7 +61,7 @@ github.com/docker/distribution/registry/client/transport github.com/docker/distribution/registry/storage/cache github.com/docker/distribution/registry/storage/cache/memory github.com/docker/distribution/uuid -# github.com/docker/docker v28.2.0-rc.1+incompatible +# github.com/docker/docker v28.2.0-rc.1.0.20250519201520-8601b22f5db5+incompatible ## explicit github.com/docker/docker/api github.com/docker/docker/api/types