Skip to content

Commit 8743ffd

Browse files
authored
Merge pull request #4605 from thaJeztah/update_engine
vendor: github.com/docker/docker cdb3f9fb8dca (v25.0.0-dev)
2 parents 8890a38 + 46d0ba2 commit 8743ffd

File tree

162 files changed

+12072
-4178
lines changed

Some content is hidden

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

162 files changed

+12072
-4178
lines changed

cli/command/completion/functions.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/docker/cli/cli/command"
77
"github.com/docker/cli/cli/command/formatter"
88
"github.com/docker/docker/api/types"
9+
"github.com/docker/docker/api/types/container"
910
"github.com/docker/docker/api/types/volume"
1011
"github.com/spf13/cobra"
1112
)
@@ -33,7 +34,7 @@ func ImageNames(dockerCli command.Cli) ValidArgsFn {
3334
// Set DOCKER_COMPLETION_SHOW_CONTAINER_IDS=yes to also complete IDs.
3435
func ContainerNames(dockerCli command.Cli, all bool, filters ...func(types.Container) bool) ValidArgsFn {
3536
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
36-
list, err := dockerCli.Client().ContainerList(cmd.Context(), types.ContainerListOptions{
37+
list, err := dockerCli.Client().ContainerList(cmd.Context(), container.ListOptions{
3738
All: all,
3839
})
3940
if err != nil {

cli/command/container/attach.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func runAttach(dockerCli command.Cli, opts *attachOptions) error {
9191
detachKeys = opts.detachKeys
9292
}
9393

94-
options := types.ContainerAttachOptions{
94+
options := container.AttachOptions{
9595
Stream: true,
9696
Stdin: !opts.noStdin && c.Config.OpenStdin,
9797
Stdout: true,

cli/command/container/client_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ type fakeClient struct {
2222
networkingConfig *network.NetworkingConfig,
2323
platform *specs.Platform,
2424
containerName string) (container.CreateResponse, error)
25-
containerStartFunc func(container string, options types.ContainerStartOptions) error
25+
containerStartFunc func(container string, options container.StartOptions) error
2626
imageCreateFunc func(parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error)
2727
infoFunc func() (system.Info, error)
2828
containerStatPathFunc func(container, path string) (types.ContainerPathStat, error)
2929
containerCopyFromFunc func(container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error)
30-
logFunc func(string, types.ContainerLogsOptions) (io.ReadCloser, error)
30+
logFunc func(string, container.LogsOptions) (io.ReadCloser, error)
3131
waitFunc func(string) (<-chan container.WaitResponse, <-chan error)
32-
containerListFunc func(types.ContainerListOptions) ([]types.Container, error)
32+
containerListFunc func(container.ListOptions) ([]types.Container, error)
3333
containerExportFunc func(string) (io.ReadCloser, error)
34-
containerExecResizeFunc func(id string, options types.ResizeOptions) error
35-
containerRemoveFunc func(ctx context.Context, container string, options types.ContainerRemoveOptions) error
34+
containerExecResizeFunc func(id string, options container.ResizeOptions) error
35+
containerRemoveFunc func(ctx context.Context, container string, options container.RemoveOptions) error
3636
containerKillFunc func(ctx context.Context, container, signal string) error
3737
Version string
3838
}
3939

40-
func (f *fakeClient) ContainerList(_ context.Context, options types.ContainerListOptions) ([]types.Container, error) {
40+
func (f *fakeClient) ContainerList(_ context.Context, options container.ListOptions) ([]types.Container, error) {
4141
if f.containerListFunc != nil {
4242
return f.containerListFunc(options)
4343
}
@@ -83,7 +83,7 @@ func (f *fakeClient) ContainerCreate(
8383
return container.CreateResponse{}, nil
8484
}
8585

86-
func (f *fakeClient) ContainerRemove(ctx context.Context, container string, options types.ContainerRemoveOptions) error {
86+
func (f *fakeClient) ContainerRemove(ctx context.Context, container string, options container.RemoveOptions) error {
8787
if f.containerRemoveFunc != nil {
8888
return f.containerRemoveFunc(ctx, container, options)
8989
}
@@ -118,7 +118,7 @@ func (f *fakeClient) CopyFromContainer(_ context.Context, container, srcPath str
118118
return nil, types.ContainerPathStat{}, nil
119119
}
120120

121-
func (f *fakeClient) ContainerLogs(_ context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error) {
121+
func (f *fakeClient) ContainerLogs(_ context.Context, container string, options container.LogsOptions) (io.ReadCloser, error) {
122122
if f.logFunc != nil {
123123
return f.logFunc(container, options)
124124
}
@@ -136,7 +136,7 @@ func (f *fakeClient) ContainerWait(_ context.Context, container string, _ contai
136136
return nil, nil
137137
}
138138

139-
func (f *fakeClient) ContainerStart(_ context.Context, container string, options types.ContainerStartOptions) error {
139+
func (f *fakeClient) ContainerStart(_ context.Context, container string, options container.StartOptions) error {
140140
if f.containerStartFunc != nil {
141141
return f.containerStartFunc(container, options)
142142
}
@@ -150,7 +150,7 @@ func (f *fakeClient) ContainerExport(_ context.Context, container string) (io.Re
150150
return nil, nil
151151
}
152152

153-
func (f *fakeClient) ContainerExecResize(_ context.Context, id string, options types.ResizeOptions) error {
153+
func (f *fakeClient) ContainerExecResize(_ context.Context, id string, options container.ResizeOptions) error {
154154
if f.containerExecResizeFunc != nil {
155155
return f.containerExecResizeFunc(id, options)
156156
}

cli/command/container/commit.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/docker/cli/cli/command"
99
"github.com/docker/cli/cli/command/completion"
1010
"github.com/docker/cli/opts"
11-
"github.com/docker/docker/api/types"
11+
"github.com/docker/docker/api/types/container"
1212
"github.com/spf13/cobra"
1313
)
1414

@@ -59,18 +59,13 @@ func NewCommitCommand(dockerCli command.Cli) *cobra.Command {
5959
func runCommit(dockerCli command.Cli, options *commitOptions) error {
6060
ctx := context.Background()
6161

62-
name := options.container
63-
reference := options.reference
64-
65-
commitOptions := types.ContainerCommitOptions{
66-
Reference: reference,
62+
response, err := dockerCli.Client().ContainerCommit(ctx, options.container, container.CommitOptions{
63+
Reference: options.reference,
6764
Comment: options.comment,
6865
Author: options.author,
6966
Changes: options.changes.GetAll(),
7067
Pause: options.pause,
71-
}
72-
73-
response, err := dockerCli.Client().ContainerCommit(ctx, name, commitOptions)
68+
})
7469
if err != nil {
7570
return err
7671
}

cli/command/container/list.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
flagsHelper "github.com/docker/cli/cli/flags"
1212
"github.com/docker/cli/opts"
1313
"github.com/docker/cli/templates"
14-
"github.com/docker/docker/api/types"
14+
"github.com/docker/docker/api/types/container"
1515
"github.com/pkg/errors"
1616
"github.com/spf13/cobra"
1717
)
@@ -68,8 +68,8 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
6868
return &cmd
6969
}
7070

71-
func buildContainerListOptions(opts *psOptions) (*types.ContainerListOptions, error) {
72-
options := &types.ContainerListOptions{
71+
func buildContainerListOptions(opts *psOptions) (*container.ListOptions, error) {
72+
options := &container.ListOptions{
7373
All: opts.all,
7474
Limit: opts.last,
7575
Size: opts.size,

cli/command/container/list_test.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
1111
"github.com/docker/cli/opts"
1212
"github.com/docker/docker/api/types"
13+
"github.com/docker/docker/api/types/container"
1314
"gotest.tools/v3/assert"
1415
is "gotest.tools/v3/assert/cmp"
1516
"gotest.tools/v3/golden"
@@ -129,7 +130,7 @@ func TestContainerListErrors(t *testing.T) {
129130
testCases := []struct {
130131
args []string
131132
flags map[string]string
132-
containerListFunc func(types.ContainerListOptions) ([]types.Container, error)
133+
containerListFunc func(container.ListOptions) ([]types.Container, error)
133134
expectedError string
134135
}{
135136
{
@@ -145,7 +146,7 @@ func TestContainerListErrors(t *testing.T) {
145146
expectedError: `wrong number of args for join`,
146147
},
147148
{
148-
containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) {
149+
containerListFunc: func(_ container.ListOptions) ([]types.Container, error) {
149150
return nil, fmt.Errorf("error listing containers")
150151
},
151152
expectedError: "error listing containers",
@@ -168,7 +169,7 @@ func TestContainerListErrors(t *testing.T) {
168169

169170
func TestContainerListWithoutFormat(t *testing.T) {
170171
cli := test.NewFakeCli(&fakeClient{
171-
containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) {
172+
containerListFunc: func(_ container.ListOptions) ([]types.Container, error) {
172173
return []types.Container{
173174
*Container("c1"),
174175
*Container("c2", WithName("foo")),
@@ -185,7 +186,7 @@ func TestContainerListWithoutFormat(t *testing.T) {
185186

186187
func TestContainerListNoTrunc(t *testing.T) {
187188
cli := test.NewFakeCli(&fakeClient{
188-
containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) {
189+
containerListFunc: func(_ container.ListOptions) ([]types.Container, error) {
189190
return []types.Container{
190191
*Container("c1"),
191192
*Container("c2", WithName("foo/bar")),
@@ -201,7 +202,7 @@ func TestContainerListNoTrunc(t *testing.T) {
201202
// Test for GitHub issue docker/docker#21772
202203
func TestContainerListNamesMultipleTime(t *testing.T) {
203204
cli := test.NewFakeCli(&fakeClient{
204-
containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) {
205+
containerListFunc: func(_ container.ListOptions) ([]types.Container, error) {
205206
return []types.Container{
206207
*Container("c1"),
207208
*Container("c2", WithName("foo/bar")),
@@ -217,7 +218,7 @@ func TestContainerListNamesMultipleTime(t *testing.T) {
217218
// Test for GitHub issue docker/docker#30291
218219
func TestContainerListFormatTemplateWithArg(t *testing.T) {
219220
cli := test.NewFakeCli(&fakeClient{
220-
containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) {
221+
containerListFunc: func(_ container.ListOptions) ([]types.Container, error) {
221222
return []types.Container{
222223
*Container("c1", WithLabel("some.label", "value")),
223224
*Container("c2", WithName("foo/bar"), WithLabel("foo", "bar")),
@@ -268,7 +269,7 @@ func TestContainerListFormatSizeSetsOption(t *testing.T) {
268269
tc := tc
269270
t.Run(tc.doc, func(t *testing.T) {
270271
cli := test.NewFakeCli(&fakeClient{
271-
containerListFunc: func(options types.ContainerListOptions) ([]types.Container, error) {
272+
containerListFunc: func(options container.ListOptions) ([]types.Container, error) {
272273
assert.Check(t, is.Equal(options.Size, tc.sizeExpected))
273274
return []types.Container{}, nil
274275
},
@@ -285,7 +286,7 @@ func TestContainerListFormatSizeSetsOption(t *testing.T) {
285286

286287
func TestContainerListWithConfigFormat(t *testing.T) {
287288
cli := test.NewFakeCli(&fakeClient{
288-
containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) {
289+
containerListFunc: func(_ container.ListOptions) ([]types.Container, error) {
289290
return []types.Container{
290291
*Container("c1", WithLabel("some.label", "value"), WithSize(10700000)),
291292
*Container("c2", WithName("foo/bar"), WithLabel("foo", "bar"), WithSize(3200000)),
@@ -302,7 +303,7 @@ func TestContainerListWithConfigFormat(t *testing.T) {
302303

303304
func TestContainerListWithFormat(t *testing.T) {
304305
cli := test.NewFakeCli(&fakeClient{
305-
containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) {
306+
containerListFunc: func(_ container.ListOptions) ([]types.Container, error) {
306307
return []types.Container{
307308
*Container("c1", WithLabel("some.label", "value")),
308309
*Container("c2", WithName("foo/bar"), WithLabel("foo", "bar")),

cli/command/container/logs.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/docker/cli/cli"
88
"github.com/docker/cli/cli/command"
99
"github.com/docker/cli/cli/command/completion"
10-
"github.com/docker/docker/api/types"
10+
"github.com/docker/docker/api/types/container"
1111
"github.com/docker/docker/pkg/stdcopy"
1212
"github.com/spf13/cobra"
1313
)
@@ -60,7 +60,7 @@ func runLogs(dockerCli command.Cli, opts *logsOptions) error {
6060
return err
6161
}
6262

63-
options := types.ContainerLogsOptions{
63+
responseBody, err := dockerCli.Client().ContainerLogs(ctx, c.ID, container.LogsOptions{
6464
ShowStdout: true,
6565
ShowStderr: true,
6666
Since: opts.since,
@@ -69,8 +69,7 @@ func runLogs(dockerCli command.Cli, opts *logsOptions) error {
6969
Follow: opts.follow,
7070
Tail: opts.tail,
7171
Details: opts.details,
72-
}
73-
responseBody, err := dockerCli.Client().ContainerLogs(ctx, c.ID, options)
72+
})
7473
if err != nil {
7574
return err
7675
}

cli/command/container/logs_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
is "gotest.tools/v3/assert/cmp"
1313
)
1414

15-
var logFn = func(expectedOut string) func(string, types.ContainerLogsOptions) (io.ReadCloser, error) {
16-
return func(container string, opts types.ContainerLogsOptions) (io.ReadCloser, error) {
15+
var logFn = func(expectedOut string) func(string, container.LogsOptions) (io.ReadCloser, error) {
16+
return func(container string, opts container.LogsOptions) (io.ReadCloser, error) {
1717
return io.NopCloser(strings.NewReader(expectedOut)), nil
1818
}
1919
}

cli/command/container/rm.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/docker/cli/cli"
99
"github.com/docker/cli/cli/command"
1010
"github.com/docker/cli/cli/command/completion"
11-
"github.com/docker/docker/api/types"
11+
"github.com/docker/docker/api/types/container"
1212
"github.com/docker/docker/errdefs"
1313
"github.com/pkg/errors"
1414
"github.com/spf13/cobra"
@@ -52,18 +52,16 @@ func runRm(dockerCli command.Cli, opts *rmOptions) error {
5252
ctx := context.Background()
5353

5454
var errs []string
55-
options := types.ContainerRemoveOptions{
56-
RemoveVolumes: opts.rmVolumes,
57-
RemoveLinks: opts.rmLink,
58-
Force: opts.force,
59-
}
60-
61-
errChan := parallelOperation(ctx, opts.containers, func(ctx context.Context, container string) error {
62-
container = strings.Trim(container, "/")
63-
if container == "" {
55+
errChan := parallelOperation(ctx, opts.containers, func(ctx context.Context, ctrID string) error {
56+
ctrID = strings.Trim(ctrID, "/")
57+
if ctrID == "" {
6458
return errors.New("Container name cannot be empty")
6559
}
66-
return dockerCli.Client().ContainerRemove(ctx, container, options)
60+
return dockerCli.Client().ContainerRemove(ctx, ctrID, container.RemoveOptions{
61+
RemoveVolumes: opts.rmVolumes,
62+
RemoveLinks: opts.rmLink,
63+
Force: opts.force,
64+
})
6765
})
6866

6967
for _, name := range opts.containers {

cli/command/container/rm_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"testing"
1010

1111
"github.com/docker/cli/internal/test"
12-
"github.com/docker/docker/api/types"
12+
"github.com/docker/docker/api/types/container"
1313
"github.com/docker/docker/errdefs"
1414
"gotest.tools/v3/assert"
1515
)
@@ -29,7 +29,7 @@ func TestRemoveForce(t *testing.T) {
2929
mutex := new(sync.Mutex)
3030

3131
cli := test.NewFakeCli(&fakeClient{
32-
containerRemoveFunc: func(ctx context.Context, container string, options types.ContainerRemoveOptions) error {
32+
containerRemoveFunc: func(ctx context.Context, container string, options container.RemoveOptions) error {
3333
// containerRemoveFunc is called in parallel for each container
3434
// by the remove command so append must be synchronized.
3535
mutex.Lock()

0 commit comments

Comments
 (0)