Skip to content

Commit af09051

Browse files
authored
Merge pull request #6084 from thaJeztah/bump_engine
vendor: github.com/docker/docker 8601b22f5db5 (v28.2-dev)
2 parents 067587b + ed5d975 commit af09051

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+356
-344
lines changed

cli/command/idresolver/client_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package idresolver
33
import (
44
"context"
55

6-
"github.com/docker/docker/api/types"
76
"github.com/docker/docker/api/types/swarm"
87
"github.com/docker/docker/client"
98
)
@@ -21,7 +20,7 @@ func (cli *fakeClient) NodeInspectWithRaw(_ context.Context, nodeID string) (swa
2120
return swarm.Node{}, []byte{}, nil
2221
}
2322

24-
func (cli *fakeClient) ServiceInspectWithRaw(_ context.Context, serviceID string, _ types.ServiceInspectOptions) (swarm.Service, []byte, error) {
23+
func (cli *fakeClient) ServiceInspectWithRaw(_ context.Context, serviceID string, _ swarm.ServiceInspectOptions) (swarm.Service, []byte, error) {
2524
if cli.serviceInspectFunc != nil {
2625
return cli.serviceInspectFunc(serviceID)
2726
}

cli/command/idresolver/idresolver.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package idresolver
66
import (
77
"context"
88

9-
"github.com/docker/docker/api/types"
109
"github.com/docker/docker/api/types/swarm"
1110
"github.com/docker/docker/client"
1211
"github.com/pkg/errors"
@@ -44,7 +43,7 @@ func (r *IDResolver) get(ctx context.Context, t any, id string) (string, error)
4443
}
4544
return id, nil
4645
case swarm.Service:
47-
service, _, err := r.client.ServiceInspectWithRaw(ctx, id, types.ServiceInspectOptions{})
46+
service, _, err := r.client.ServiceInspectWithRaw(ctx, id, swarm.ServiceInspectOptions{})
4847
if err != nil {
4948
// TODO(thaJeztah): should error-handling be more specific, or is it ok to ignore any error?
5049
return id, nil //nolint:nilerr // ignore nil-error being returned, as this is a best-effort.

cli/command/node/client_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package node
33
import (
44
"context"
55

6-
"github.com/docker/docker/api/types"
76
"github.com/docker/docker/api/types/swarm"
87
"github.com/docker/docker/api/types/system"
98
"github.com/docker/docker/client"
@@ -17,8 +16,8 @@ type fakeClient struct {
1716
nodeRemoveFunc func() error
1817
nodeUpdateFunc func(nodeID string, version swarm.Version, node swarm.NodeSpec) error
1918
taskInspectFunc func(taskID string) (swarm.Task, []byte, error)
20-
taskListFunc func(options types.TaskListOptions) ([]swarm.Task, error)
21-
serviceInspectFunc func(ctx context.Context, serviceID string, opts types.ServiceInspectOptions) (swarm.Service, []byte, error)
19+
taskListFunc func(options swarm.TaskListOptions) ([]swarm.Task, error)
20+
serviceInspectFunc func(ctx context.Context, serviceID string, opts swarm.ServiceInspectOptions) (swarm.Service, []byte, error)
2221
}
2322

2423
func (cli *fakeClient) NodeInspectWithRaw(context.Context, string) (swarm.Node, []byte, error) {
@@ -28,14 +27,14 @@ func (cli *fakeClient) NodeInspectWithRaw(context.Context, string) (swarm.Node,
2827
return swarm.Node{}, []byte{}, nil
2928
}
3029

31-
func (cli *fakeClient) NodeList(context.Context, types.NodeListOptions) ([]swarm.Node, error) {
30+
func (cli *fakeClient) NodeList(context.Context, swarm.NodeListOptions) ([]swarm.Node, error) {
3231
if cli.nodeListFunc != nil {
3332
return cli.nodeListFunc()
3433
}
3534
return []swarm.Node{}, nil
3635
}
3736

38-
func (cli *fakeClient) NodeRemove(context.Context, string, types.NodeRemoveOptions) error {
37+
func (cli *fakeClient) NodeRemove(context.Context, string, swarm.NodeRemoveOptions) error {
3938
if cli.nodeRemoveFunc != nil {
4039
return cli.nodeRemoveFunc()
4140
}
@@ -63,14 +62,14 @@ func (cli *fakeClient) TaskInspectWithRaw(_ context.Context, taskID string) (swa
6362
return swarm.Task{}, []byte{}, nil
6463
}
6564

66-
func (cli *fakeClient) TaskList(_ context.Context, options types.TaskListOptions) ([]swarm.Task, error) {
65+
func (cli *fakeClient) TaskList(_ context.Context, options swarm.TaskListOptions) ([]swarm.Task, error) {
6766
if cli.taskListFunc != nil {
6867
return cli.taskListFunc(options)
6968
}
7069
return []swarm.Task{}, nil
7170
}
7271

73-
func (cli *fakeClient) ServiceInspectWithRaw(ctx context.Context, serviceID string, opts types.ServiceInspectOptions) (swarm.Service, []byte, error) {
72+
func (cli *fakeClient) ServiceInspectWithRaw(ctx context.Context, serviceID string, opts swarm.ServiceInspectOptions) (swarm.Service, []byte, error) {
7473
if cli.serviceInspectFunc != nil {
7574
return cli.serviceInspectFunc(ctx, serviceID, opts)
7675
}

cli/command/node/cmd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
"github.com/docker/cli/cli"
88
"github.com/docker/cli/cli/command"
9-
"github.com/docker/docker/api/types"
9+
"github.com/docker/docker/api/types/swarm"
1010
"github.com/docker/docker/client"
1111
"github.com/spf13/cobra"
1212
)
@@ -48,7 +48,7 @@ func Reference(ctx context.Context, apiClient client.APIClient, ref string) (str
4848
// If there's no node ID in /info, the node probably
4949
// isn't a manager. Call a swarm-specific endpoint to
5050
// get a more specific error message.
51-
_, err = apiClient.NodeList(ctx, types.NodeListOptions{})
51+
_, err = apiClient.NodeList(ctx, swarm.NodeListOptions{})
5252
if err != nil {
5353
return "", err
5454
}

cli/command/node/completion.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"os"
55

66
"github.com/docker/cli/cli/command/completion"
7-
"github.com/docker/docker/api/types"
7+
"github.com/docker/docker/api/types/swarm"
88
"github.com/spf13/cobra"
99
)
1010

@@ -17,7 +17,7 @@ func completeNodeNames(dockerCLI completion.APIClientProvider) cobra.CompletionF
1717
// https://github.com/docker/cli/blob/f9ced58158d5e0b358052432244b483774a1983d/contrib/completion/bash/docker#L41-L43
1818
showIDs := os.Getenv("DOCKER_COMPLETION_SHOW_NODE_IDS") == "yes"
1919
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
20-
list, err := dockerCLI.Client().NodeList(cmd.Context(), types.NodeListOptions{})
20+
list, err := dockerCLI.Client().NodeList(cmd.Context(), swarm.NodeListOptions{})
2121
if err != nil {
2222
return nil, cobra.ShellCompDirectiveError
2323
}

cli/command/node/list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/docker/cli/cli/command/formatter"
1111
flagsHelper "github.com/docker/cli/cli/flags"
1212
"github.com/docker/cli/opts"
13-
"github.com/docker/docker/api/types"
13+
"github.com/docker/docker/api/types/swarm"
1414
"github.com/docker/docker/api/types/system"
1515
"github.com/fvbommel/sortorder"
1616
"github.com/spf13/cobra"
@@ -55,7 +55,7 @@ func runList(ctx context.Context, dockerCli command.Cli, options listOptions) er
5555

5656
nodes, err := client.NodeList(
5757
ctx,
58-
types.NodeListOptions{Filters: options.filter.Value()})
58+
swarm.NodeListOptions{Filters: options.filter.Value()})
5959
if err != nil {
6060
return err
6161
}

cli/command/node/ps.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/docker/cli/cli/command/idresolver"
1111
"github.com/docker/cli/cli/command/task"
1212
"github.com/docker/cli/opts"
13-
"github.com/docker/docker/api/types"
1413
"github.com/docker/docker/api/types/swarm"
1514
"github.com/pkg/errors"
1615
"github.com/spf13/cobra"
@@ -84,7 +83,7 @@ func runPs(ctx context.Context, dockerCli command.Cli, options psOptions) error
8483
filter := options.filter.Value()
8584
filter.Add("node", node.ID)
8685

87-
nodeTasks, err := client.TaskList(ctx, types.TaskListOptions{Filters: filter})
86+
nodeTasks, err := client.TaskList(ctx, swarm.TaskListOptions{Filters: filter})
8887
if err != nil {
8988
errs = append(errs, err.Error())
9089
continue

cli/command/node/ps_test.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010

1111
"github.com/docker/cli/internal/test"
1212
"github.com/docker/cli/internal/test/builders"
13-
"github.com/docker/docker/api/types"
1413
"github.com/docker/docker/api/types/swarm"
1514
"github.com/docker/docker/api/types/system"
1615
"gotest.tools/v3/assert"
@@ -23,7 +22,7 @@ func TestNodePsErrors(t *testing.T) {
2322
flags map[string]string
2423
infoFunc func() (system.Info, error)
2524
nodeInspectFunc func() (swarm.Node, []byte, error)
26-
taskListFunc func(options types.TaskListOptions) ([]swarm.Task, error)
25+
taskListFunc func(options swarm.TaskListOptions) ([]swarm.Task, error)
2726
taskInspectFunc func(taskID string) (swarm.Task, []byte, error)
2827
expectedError string
2928
}{
@@ -42,7 +41,7 @@ func TestNodePsErrors(t *testing.T) {
4241
},
4342
{
4443
args: []string{"nodeID"},
45-
taskListFunc: func(options types.TaskListOptions) ([]swarm.Task, error) {
44+
taskListFunc: func(options swarm.TaskListOptions) ([]swarm.Task, error) {
4645
return []swarm.Task{}, errors.New("error returning the task list")
4746
},
4847
expectedError: "error returning the task list",
@@ -73,17 +72,17 @@ func TestNodePs(t *testing.T) {
7372
flags map[string]string
7473
infoFunc func() (system.Info, error)
7574
nodeInspectFunc func() (swarm.Node, []byte, error)
76-
taskListFunc func(options types.TaskListOptions) ([]swarm.Task, error)
75+
taskListFunc func(options swarm.TaskListOptions) ([]swarm.Task, error)
7776
taskInspectFunc func(taskID string) (swarm.Task, []byte, error)
78-
serviceInspectFunc func(ctx context.Context, serviceID string, opts types.ServiceInspectOptions) (swarm.Service, []byte, error)
77+
serviceInspectFunc func(ctx context.Context, serviceID string, opts swarm.ServiceInspectOptions) (swarm.Service, []byte, error)
7978
}{
8079
{
8180
name: "simple",
8281
args: []string{"nodeID"},
8382
nodeInspectFunc: func() (swarm.Node, []byte, error) {
8483
return *builders.Node(), []byte{}, nil
8584
},
86-
taskListFunc: func(options types.TaskListOptions) ([]swarm.Task, error) {
85+
taskListFunc: func(options swarm.TaskListOptions) ([]swarm.Task, error) {
8786
return []swarm.Task{
8887
*builders.Task(builders.WithStatus(builders.Timestamp(time.Now().Add(-2*time.Hour)), builders.PortStatus([]swarm.PortConfig{
8988
{
@@ -94,7 +93,7 @@ func TestNodePs(t *testing.T) {
9493
}))),
9594
}, nil
9695
},
97-
serviceInspectFunc: func(ctx context.Context, serviceID string, opts types.ServiceInspectOptions) (swarm.Service, []byte, error) {
96+
serviceInspectFunc: func(ctx context.Context, serviceID string, opts swarm.ServiceInspectOptions) (swarm.Service, []byte, error) {
9897
return swarm.Service{
9998
ID: serviceID,
10099
Spec: swarm.ServiceSpec{
@@ -111,7 +110,7 @@ func TestNodePs(t *testing.T) {
111110
nodeInspectFunc: func() (swarm.Node, []byte, error) {
112111
return *builders.Node(), []byte{}, nil
113112
},
114-
taskListFunc: func(options types.TaskListOptions) ([]swarm.Task, error) {
113+
taskListFunc: func(options swarm.TaskListOptions) ([]swarm.Task, error) {
115114
return []swarm.Task{
116115
*builders.Task(builders.TaskID("taskID1"), builders.TaskServiceID("failure"),
117116
builders.WithStatus(builders.Timestamp(time.Now().Add(-2*time.Hour)), builders.StatusErr("a task error"))),
@@ -121,7 +120,7 @@ func TestNodePs(t *testing.T) {
121120
builders.WithStatus(builders.Timestamp(time.Now().Add(-4*time.Hour)), builders.StatusErr("a task error"))),
122121
}, nil
123122
},
124-
serviceInspectFunc: func(ctx context.Context, serviceID string, opts types.ServiceInspectOptions) (swarm.Service, []byte, error) {
123+
serviceInspectFunc: func(ctx context.Context, serviceID string, opts swarm.ServiceInspectOptions) (swarm.Service, []byte, error) {
125124
return swarm.Service{
126125
ID: serviceID,
127126
Spec: swarm.ServiceSpec{

cli/command/node/remove.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
"github.com/docker/cli/cli"
99
"github.com/docker/cli/cli/command"
10-
"github.com/docker/docker/api/types"
10+
"github.com/docker/docker/api/types/swarm"
1111
"github.com/spf13/cobra"
1212
)
1313

@@ -38,7 +38,7 @@ func runRemove(ctx context.Context, dockerCLI command.Cli, nodeIDs []string, opt
3838

3939
var errs []error
4040
for _, id := range nodeIDs {
41-
if err := apiClient.NodeRemove(ctx, id, types.NodeRemoveOptions{Force: opts.force}); err != nil {
41+
if err := apiClient.NodeRemove(ctx, id, swarm.NodeRemoveOptions{Force: opts.force}); err != nil {
4242
errs = append(errs, err)
4343
continue
4444
}

cli/command/service/client_test.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55

66
"github.com/docker/cli/internal/test/builders"
7-
"github.com/docker/docker/api/types"
87
"github.com/docker/docker/api/types/network"
98
"github.com/docker/docker/api/types/swarm"
109
"github.com/docker/docker/api/types/system"
@@ -13,46 +12,46 @@ import (
1312

1413
type fakeClient struct {
1514
client.Client
16-
serviceInspectWithRawFunc func(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error)
17-
serviceUpdateFunc func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error)
18-
serviceListFunc func(context.Context, types.ServiceListOptions) ([]swarm.Service, error)
19-
taskListFunc func(context.Context, types.TaskListOptions) ([]swarm.Task, error)
15+
serviceInspectWithRawFunc func(ctx context.Context, serviceID string, options swarm.ServiceInspectOptions) (swarm.Service, []byte, error)
16+
serviceUpdateFunc func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options swarm.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error)
17+
serviceListFunc func(context.Context, swarm.ServiceListOptions) ([]swarm.Service, error)
18+
taskListFunc func(context.Context, swarm.TaskListOptions) ([]swarm.Task, error)
2019
infoFunc func(ctx context.Context) (system.Info, error)
2120
networkInspectFunc func(ctx context.Context, networkID string, options network.InspectOptions) (network.Inspect, error)
22-
nodeListFunc func(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error)
21+
nodeListFunc func(ctx context.Context, options swarm.NodeListOptions) ([]swarm.Node, error)
2322
}
2423

25-
func (f *fakeClient) NodeList(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error) {
24+
func (f *fakeClient) NodeList(ctx context.Context, options swarm.NodeListOptions) ([]swarm.Node, error) {
2625
if f.nodeListFunc != nil {
2726
return f.nodeListFunc(ctx, options)
2827
}
2928
return nil, nil
3029
}
3130

32-
func (f *fakeClient) TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error) {
31+
func (f *fakeClient) TaskList(ctx context.Context, options swarm.TaskListOptions) ([]swarm.Task, error) {
3332
if f.taskListFunc != nil {
3433
return f.taskListFunc(ctx, options)
3534
}
3635
return nil, nil
3736
}
3837

39-
func (f *fakeClient) ServiceInspectWithRaw(ctx context.Context, serviceID string, options types.ServiceInspectOptions) (swarm.Service, []byte, error) {
38+
func (f *fakeClient) ServiceInspectWithRaw(ctx context.Context, serviceID string, options swarm.ServiceInspectOptions) (swarm.Service, []byte, error) {
4039
if f.serviceInspectWithRawFunc != nil {
4140
return f.serviceInspectWithRawFunc(ctx, serviceID, options)
4241
}
4342

4443
return *builders.Service(builders.ServiceID(serviceID)), []byte{}, nil
4544
}
4645

47-
func (f *fakeClient) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) {
46+
func (f *fakeClient) ServiceList(ctx context.Context, options swarm.ServiceListOptions) ([]swarm.Service, error) {
4847
if f.serviceListFunc != nil {
4948
return f.serviceListFunc(ctx, options)
5049
}
5150

5251
return nil, nil
5352
}
5453

55-
func (f *fakeClient) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) {
54+
func (f *fakeClient) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options swarm.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error) {
5655
if f.serviceUpdateFunc != nil {
5756
return f.serviceUpdateFunc(ctx, serviceID, version, service, options)
5857
}

cli/command/service/completion.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"os"
55

66
"github.com/docker/cli/cli/command/completion"
7-
"github.com/docker/docker/api/types"
7+
"github.com/docker/docker/api/types/swarm"
88
"github.com/spf13/cobra"
99
)
1010

@@ -15,7 +15,7 @@ func completeServiceNames(dockerCLI completion.APIClientProvider) cobra.Completi
1515
// https://github.com/docker/cli/blob/f9ced58158d5e0b358052432244b483774a1983d/contrib/completion/bash/docker#L41-L43
1616
showIDs := os.Getenv("DOCKER_COMPLETION_SHOW_SERVICE_IDS") == "yes"
1717
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
18-
list, err := dockerCLI.Client().ServiceList(cmd.Context(), types.ServiceListOptions{})
18+
list, err := dockerCLI.Client().ServiceList(cmd.Context(), swarm.ServiceListOptions{})
1919
if err != nil {
2020
return nil, cobra.ShellCompDirectiveError
2121
}

cli/command/service/create.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"github.com/docker/cli/cli/command"
99
"github.com/docker/cli/cli/command/completion"
1010
cliopts "github.com/docker/cli/opts"
11-
"github.com/docker/docker/api/types"
1211
"github.com/docker/docker/api/types/swarm"
1312
"github.com/docker/docker/api/types/versions"
1413
"github.com/docker/docker/client"
@@ -102,7 +101,7 @@ func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
102101

103102
func runCreate(ctx context.Context, dockerCLI command.Cli, flags *pflag.FlagSet, opts *serviceOptions) error {
104103
apiClient := dockerCLI.Client()
105-
createOpts := types.ServiceCreateOptions{}
104+
createOpts := swarm.ServiceCreateOptions{}
106105

107106
service, err := opts.ToService(ctx, apiClient, flags)
108107
if err != nil {

cli/command/service/inspect.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313
"github.com/docker/cli/cli/command/completion"
1414
"github.com/docker/cli/cli/command/formatter"
1515
flagsHelper "github.com/docker/cli/cli/flags"
16-
"github.com/docker/docker/api/types"
1716
"github.com/docker/docker/api/types/network"
17+
"github.com/docker/docker/api/types/swarm"
1818
"github.com/pkg/errors"
1919
"github.com/spf13/cobra"
2020
"github.com/spf13/pflag"
@@ -66,7 +66,7 @@ func runInspect(ctx context.Context, dockerCli command.Cli, opts inspectOptions)
6666

6767
getRef := func(ref string) (any, []byte, error) {
6868
// Service inspect shows defaults values in empty fields.
69-
service, _, err := client.ServiceInspectWithRaw(ctx, ref, types.ServiceInspectOptions{InsertDefaults: true})
69+
service, _, err := client.ServiceInspectWithRaw(ctx, ref, swarm.ServiceInspectOptions{InsertDefaults: true})
7070
if err == nil || !cerrdefs.IsNotFound(err) {
7171
return service, nil, err
7272
}

0 commit comments

Comments
 (0)