Skip to content

Commit 0ffb724

Browse files
authored
Merge pull request #6083 from thaJeztah/bump_engine
vendor: github.com/docker/docker 7937f0846c13 (master, v28.x dev)
2 parents d1857de + 4665398 commit 0ffb724

38 files changed

+326
-265
lines changed

cli/command/cli.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"github.com/docker/cli/cli/version"
2525
dopts "github.com/docker/cli/opts"
2626
"github.com/docker/docker/api"
27-
"github.com/docker/docker/api/types"
27+
"github.com/docker/docker/api/types/build"
2828
"github.com/docker/docker/api/types/swarm"
2929
"github.com/docker/docker/client"
3030
"github.com/pkg/errors"
@@ -180,7 +180,7 @@ func (cli *DockerCli) BuildKitEnabled() (bool, error) {
180180
}
181181

182182
si := cli.ServerInfo()
183-
if si.BuildkitVersion == types.BuilderBuildKit {
183+
if si.BuildkitVersion == build.BuilderBuildKit {
184184
// The daemon advertised BuildKit as the preferred builder; this may
185185
// be either a Linux daemon or a Windows daemon with experimental
186186
// BuildKit support enabled.
@@ -510,7 +510,7 @@ func (cli *DockerCli) Apply(ops ...CLIOption) error {
510510
type ServerInfo struct {
511511
HasExperimental bool
512512
OSType string
513-
BuildkitVersion types.BuilderVersion
513+
BuildkitVersion build.BuilderVersion
514514

515515
// SwarmStatus provides information about the current swarm status of the
516516
// engine, obtained from the "Swarm" header in the API response.

cli/command/config/client_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,23 @@ package config
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
)
109

1110
type fakeClient struct {
1211
client.Client
13-
configCreateFunc func(context.Context, swarm.ConfigSpec) (types.ConfigCreateResponse, error)
12+
configCreateFunc func(context.Context, swarm.ConfigSpec) (swarm.ConfigCreateResponse, error)
1413
configInspectFunc func(context.Context, string) (swarm.Config, []byte, error)
15-
configListFunc func(context.Context, types.ConfigListOptions) ([]swarm.Config, error)
14+
configListFunc func(context.Context, swarm.ConfigListOptions) ([]swarm.Config, error)
1615
configRemoveFunc func(string) error
1716
}
1817

19-
func (c *fakeClient) ConfigCreate(ctx context.Context, spec swarm.ConfigSpec) (types.ConfigCreateResponse, error) {
18+
func (c *fakeClient) ConfigCreate(ctx context.Context, spec swarm.ConfigSpec) (swarm.ConfigCreateResponse, error) {
2019
if c.configCreateFunc != nil {
2120
return c.configCreateFunc(ctx, spec)
2221
}
23-
return types.ConfigCreateResponse{}, nil
22+
return swarm.ConfigCreateResponse{}, nil
2423
}
2524

2625
func (c *fakeClient) ConfigInspectWithRaw(ctx context.Context, id string) (swarm.Config, []byte, error) {
@@ -30,7 +29,7 @@ func (c *fakeClient) ConfigInspectWithRaw(ctx context.Context, id string) (swarm
3029
return swarm.Config{}, nil, nil
3130
}
3231

33-
func (c *fakeClient) ConfigList(ctx context.Context, options types.ConfigListOptions) ([]swarm.Config, error) {
32+
func (c *fakeClient) ConfigList(ctx context.Context, options swarm.ConfigListOptions) ([]swarm.Config, error) {
3433
if c.configListFunc != nil {
3534
return c.configListFunc(ctx, options)
3635
}

cli/command/config/cmd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"github.com/docker/cli/cli"
55
"github.com/docker/cli/cli/command"
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

@@ -32,7 +32,7 @@ func NewConfigCommand(dockerCli command.Cli) *cobra.Command {
3232
// completeNames offers completion for swarm configs
3333
func completeNames(dockerCLI completion.APIClientProvider) cobra.CompletionFunc {
3434
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
35-
list, err := dockerCLI.Client().ConfigList(cmd.Context(), types.ConfigListOptions{})
35+
list, err := dockerCLI.Client().ConfigList(cmd.Context(), swarm.ConfigListOptions{})
3636
if err != nil {
3737
return nil, cobra.ShellCompDirectiveError
3838
}

cli/command/config/create_test.go

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"testing"
1313

1414
"github.com/docker/cli/internal/test"
15-
"github.com/docker/docker/api/types"
1615
"github.com/docker/docker/api/types/swarm"
1716
"gotest.tools/v3/assert"
1817
is "gotest.tools/v3/assert/cmp"
@@ -24,7 +23,7 @@ const configDataFile = "config-create-with-name.golden"
2423
func TestConfigCreateErrors(t *testing.T) {
2524
testCases := []struct {
2625
args []string
27-
configCreateFunc func(context.Context, swarm.ConfigSpec) (types.ConfigCreateResponse, error)
26+
configCreateFunc func(context.Context, swarm.ConfigSpec) (swarm.ConfigCreateResponse, error)
2827
expectedError string
2928
}{
3029
{
@@ -37,8 +36,8 @@ func TestConfigCreateErrors(t *testing.T) {
3736
},
3837
{
3938
args: []string{"name", filepath.Join("testdata", configDataFile)},
40-
configCreateFunc: func(_ context.Context, configSpec swarm.ConfigSpec) (types.ConfigCreateResponse, error) {
41-
return types.ConfigCreateResponse{}, errors.New("error creating config")
39+
configCreateFunc: func(_ context.Context, configSpec swarm.ConfigSpec) (swarm.ConfigCreateResponse, error) {
40+
return swarm.ConfigCreateResponse{}, errors.New("error creating config")
4241
},
4342
expectedError: "error creating config",
4443
},
@@ -62,14 +61,14 @@ func TestConfigCreateWithName(t *testing.T) {
6261
const name = "config-with-name"
6362
var actual []byte
6463
cli := test.NewFakeCli(&fakeClient{
65-
configCreateFunc: func(_ context.Context, spec swarm.ConfigSpec) (types.ConfigCreateResponse, error) {
64+
configCreateFunc: func(_ context.Context, spec swarm.ConfigSpec) (swarm.ConfigCreateResponse, error) {
6665
if spec.Name != name {
67-
return types.ConfigCreateResponse{}, fmt.Errorf("expected name %q, got %q", name, spec.Name)
66+
return swarm.ConfigCreateResponse{}, fmt.Errorf("expected name %q, got %q", name, spec.Name)
6867
}
6968

7069
actual = spec.Data
7170

72-
return types.ConfigCreateResponse{
71+
return swarm.ConfigCreateResponse{
7372
ID: "ID-" + spec.Name,
7473
}, nil
7574
},
@@ -101,12 +100,12 @@ func TestConfigCreateWithLabels(t *testing.T) {
101100
}
102101

103102
cli := test.NewFakeCli(&fakeClient{
104-
configCreateFunc: func(_ context.Context, spec swarm.ConfigSpec) (types.ConfigCreateResponse, error) {
103+
configCreateFunc: func(_ context.Context, spec swarm.ConfigSpec) (swarm.ConfigCreateResponse, error) {
105104
if !reflect.DeepEqual(spec, expected) {
106-
return types.ConfigCreateResponse{}, fmt.Errorf("expected %+v, got %+v", expected, spec)
105+
return swarm.ConfigCreateResponse{}, fmt.Errorf("expected %+v, got %+v", expected, spec)
107106
}
108107

109-
return types.ConfigCreateResponse{
108+
return swarm.ConfigCreateResponse{
110109
ID: "ID-" + spec.Name,
111110
}, nil
112111
},
@@ -127,16 +126,16 @@ func TestConfigCreateWithTemplatingDriver(t *testing.T) {
127126
const name = "config-with-template-driver"
128127

129128
cli := test.NewFakeCli(&fakeClient{
130-
configCreateFunc: func(_ context.Context, spec swarm.ConfigSpec) (types.ConfigCreateResponse, error) {
129+
configCreateFunc: func(_ context.Context, spec swarm.ConfigSpec) (swarm.ConfigCreateResponse, error) {
131130
if spec.Name != name {
132-
return types.ConfigCreateResponse{}, fmt.Errorf("expected name %q, got %q", name, spec.Name)
131+
return swarm.ConfigCreateResponse{}, fmt.Errorf("expected name %q, got %q", name, spec.Name)
133132
}
134133

135134
if spec.Templating.Name != expectedDriver.Name {
136-
return types.ConfigCreateResponse{}, fmt.Errorf("expected driver %v, got %v", expectedDriver, spec.Labels)
135+
return swarm.ConfigCreateResponse{}, fmt.Errorf("expected driver %v, got %v", expectedDriver, spec.Labels)
137136
}
138137

139-
return types.ConfigCreateResponse{
138+
return swarm.ConfigCreateResponse{
140139
ID: "ID-" + spec.Name,
141140
}, nil
142141
},

cli/command/config/ls.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/fvbommel/sortorder"
1515
"github.com/spf13/cobra"
1616
)
@@ -48,7 +48,7 @@ func newConfigListCommand(dockerCli command.Cli) *cobra.Command {
4848
func RunConfigList(ctx context.Context, dockerCLI command.Cli, options ListOptions) error {
4949
apiClient := dockerCLI.Client()
5050

51-
configs, err := apiClient.ConfigList(ctx, types.ConfigListOptions{Filters: options.Filter.Value()})
51+
configs, err := apiClient.ConfigList(ctx, swarm.ConfigListOptions{Filters: options.Filter.Value()})
5252
if err != nil {
5353
return err
5454
}

cli/command/config/ls_test.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/docker/cli/cli/config/configfile"
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
"gotest.tools/v3/assert"
1615
is "gotest.tools/v3/assert/cmp"
@@ -20,15 +19,15 @@ import (
2019
func TestConfigListErrors(t *testing.T) {
2120
testCases := []struct {
2221
args []string
23-
configListFunc func(context.Context, types.ConfigListOptions) ([]swarm.Config, error)
22+
configListFunc func(context.Context, swarm.ConfigListOptions) ([]swarm.Config, error)
2423
expectedError string
2524
}{
2625
{
2726
args: []string{"foo"},
2827
expectedError: "accepts no argument",
2928
},
3029
{
31-
configListFunc: func(_ context.Context, options types.ConfigListOptions) ([]swarm.Config, error) {
30+
configListFunc: func(_ context.Context, options swarm.ConfigListOptions) ([]swarm.Config, error) {
3231
return []swarm.Config{}, errors.New("error listing configs")
3332
},
3433
expectedError: "error listing configs",
@@ -49,7 +48,7 @@ func TestConfigListErrors(t *testing.T) {
4948

5049
func TestConfigList(t *testing.T) {
5150
cli := test.NewFakeCli(&fakeClient{
52-
configListFunc: func(_ context.Context, options types.ConfigListOptions) ([]swarm.Config, error) {
51+
configListFunc: func(_ context.Context, options swarm.ConfigListOptions) ([]swarm.Config, error) {
5352
return []swarm.Config{
5453
*builders.Config(builders.ConfigID("ID-1-foo"),
5554
builders.ConfigName("1-foo"),
@@ -79,7 +78,7 @@ func TestConfigList(t *testing.T) {
7978

8079
func TestConfigListWithQuietOption(t *testing.T) {
8180
cli := test.NewFakeCli(&fakeClient{
82-
configListFunc: func(_ context.Context, options types.ConfigListOptions) ([]swarm.Config, error) {
81+
configListFunc: func(_ context.Context, options swarm.ConfigListOptions) ([]swarm.Config, error) {
8382
return []swarm.Config{
8483
*builders.Config(builders.ConfigID("ID-foo"), builders.ConfigName("foo")),
8584
*builders.Config(builders.ConfigID("ID-bar"), builders.ConfigName("bar"), builders.ConfigLabels(map[string]string{
@@ -96,7 +95,7 @@ func TestConfigListWithQuietOption(t *testing.T) {
9695

9796
func TestConfigListWithConfigFormat(t *testing.T) {
9897
cli := test.NewFakeCli(&fakeClient{
99-
configListFunc: func(_ context.Context, options types.ConfigListOptions) ([]swarm.Config, error) {
98+
configListFunc: func(_ context.Context, options swarm.ConfigListOptions) ([]swarm.Config, error) {
10099
return []swarm.Config{
101100
*builders.Config(builders.ConfigID("ID-foo"), builders.ConfigName("foo")),
102101
*builders.Config(builders.ConfigID("ID-bar"), builders.ConfigName("bar"), builders.ConfigLabels(map[string]string{
@@ -115,7 +114,7 @@ func TestConfigListWithConfigFormat(t *testing.T) {
115114

116115
func TestConfigListWithFormat(t *testing.T) {
117116
cli := test.NewFakeCli(&fakeClient{
118-
configListFunc: func(_ context.Context, options types.ConfigListOptions) ([]swarm.Config, error) {
117+
configListFunc: func(_ context.Context, options swarm.ConfigListOptions) ([]swarm.Config, error) {
119118
return []swarm.Config{
120119
*builders.Config(builders.ConfigID("ID-foo"), builders.ConfigName("foo")),
121120
*builders.Config(builders.ConfigID("ID-bar"), builders.ConfigName("bar"), builders.ConfigLabels(map[string]string{
@@ -132,7 +131,7 @@ func TestConfigListWithFormat(t *testing.T) {
132131

133132
func TestConfigListWithFilter(t *testing.T) {
134133
cli := test.NewFakeCli(&fakeClient{
135-
configListFunc: func(_ context.Context, options types.ConfigListOptions) ([]swarm.Config, error) {
134+
configListFunc: func(_ context.Context, options swarm.ConfigListOptions) ([]swarm.Config, error) {
136135
assert.Check(t, is.Equal("foo", options.Filters.Get("name")[0]))
137136
assert.Check(t, is.Equal("lbl1=Label-bar", options.Filters.Get("label")[0]))
138137
return []swarm.Config{

cli/command/image/build.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"github.com/docker/cli/internal/lazyregexp"
2626
"github.com/docker/cli/opts"
2727
"github.com/docker/docker/api"
28-
"github.com/docker/docker/api/types"
28+
buildtypes "github.com/docker/docker/api/types/build"
2929
"github.com/docker/docker/api/types/container"
3030
registrytypes "github.com/docker/docker/api/types/registry"
3131
"github.com/docker/docker/builder/remotecontext/urlutil"
@@ -337,7 +337,7 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
337337
authConfigs[k] = registrytypes.AuthConfig(auth)
338338
}
339339
buildOpts := imageBuildOptions(dockerCli, options)
340-
buildOpts.Version = types.BuilderV1
340+
buildOpts.Version = buildtypes.BuilderV1
341341
buildOpts.Dockerfile = relDockerfile
342342
buildOpts.AuthConfigs = authConfigs
343343
buildOpts.RemoteContext = remote
@@ -354,7 +354,7 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
354354

355355
imageID := ""
356356
aux := func(msg jsonstream.JSONMessage) {
357-
var result types.BuildResult
357+
var result buildtypes.Result
358358
if err := json.Unmarshal(*msg.Aux, &result); err != nil {
359359
_, _ = fmt.Fprintf(dockerCli.Err(), "Failed to parse aux message: %s", err)
360360
} else {
@@ -540,9 +540,9 @@ func replaceDockerfileForContentTrust(ctx context.Context, inputTarStream io.Rea
540540
return pipeReader
541541
}
542542

543-
func imageBuildOptions(dockerCli command.Cli, options buildOptions) types.ImageBuildOptions {
543+
func imageBuildOptions(dockerCli command.Cli, options buildOptions) buildtypes.ImageBuildOptions {
544544
configFile := dockerCli.ConfigFile()
545-
return types.ImageBuildOptions{
545+
return buildtypes.ImageBuildOptions{
546546
Memory: options.memory.Value(),
547547
MemorySwap: options.memorySwap.Value(),
548548
Tags: options.tags.GetSlice(),

cli/command/image/build_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
"github.com/docker/cli/cli/streams"
1515
"github.com/docker/cli/internal/test"
16-
"github.com/docker/docker/api/types"
16+
"github.com/docker/docker/api/types/build"
1717
"github.com/google/go-cmp/cmp"
1818
"github.com/moby/go-archive/compression"
1919
"gotest.tools/v3/assert"
@@ -25,7 +25,7 @@ func TestRunBuildDockerfileFromStdinWithCompress(t *testing.T) {
2525
t.Setenv("DOCKER_BUILDKIT", "0")
2626
buffer := new(bytes.Buffer)
2727
fakeBuild := newFakeBuild()
28-
fakeImageBuild := func(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error) {
28+
fakeImageBuild := func(ctx context.Context, buildContext io.Reader, options build.ImageBuildOptions) (build.ImageBuildResponse, error) {
2929
tee := io.TeeReader(buildContext, buffer)
3030
gzipReader, err := gzip.NewReader(tee)
3131
assert.NilError(t, err)
@@ -178,18 +178,18 @@ RUN echo hello world
178178

179179
type fakeBuild struct {
180180
context *tar.Reader
181-
options types.ImageBuildOptions
181+
options build.ImageBuildOptions
182182
}
183183

184184
func newFakeBuild() *fakeBuild {
185185
return &fakeBuild{}
186186
}
187187

188-
func (f *fakeBuild) build(_ context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error) {
188+
func (f *fakeBuild) build(_ context.Context, buildContext io.Reader, options build.ImageBuildOptions) (build.ImageBuildResponse, error) {
189189
f.context = tar.NewReader(buildContext)
190190
f.options = options
191191
body := new(bytes.Buffer)
192-
return types.ImageBuildResponse{Body: io.NopCloser(body)}, nil
192+
return build.ImageBuildResponse{Body: io.NopCloser(body)}, nil
193193
}
194194

195195
func (f *fakeBuild) headers(t *testing.T) []*tar.Header {

cli/command/image/client_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"strings"
77
"time"
88

9-
"github.com/docker/docker/api/types"
9+
"github.com/docker/docker/api/types/build"
1010
"github.com/docker/docker/api/types/filters"
1111
"github.com/docker/docker/api/types/image"
1212
"github.com/docker/docker/api/types/system"
@@ -27,7 +27,7 @@ type fakeClient struct {
2727
imageInspectFunc func(img string) (image.InspectResponse, error)
2828
imageImportFunc func(source image.ImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error)
2929
imageHistoryFunc func(img string, options ...client.ImageHistoryOption) ([]image.HistoryResponseItem, error)
30-
imageBuildFunc func(context.Context, io.Reader, types.ImageBuildOptions) (types.ImageBuildResponse, error)
30+
imageBuildFunc func(context.Context, io.Reader, build.ImageBuildOptions) (build.ImageBuildResponse, error)
3131
}
3232

3333
func (cli *fakeClient) ImageTag(_ context.Context, img, ref string) error {
@@ -118,9 +118,9 @@ func (cli *fakeClient) ImageHistory(_ context.Context, img string, options ...cl
118118
return []image.HistoryResponseItem{{ID: img, Created: time.Now().Unix()}}, nil
119119
}
120120

121-
func (cli *fakeClient) ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error) {
121+
func (cli *fakeClient) ImageBuild(ctx context.Context, buildContext io.Reader, options build.ImageBuildOptions) (build.ImageBuildResponse, error) {
122122
if cli.imageBuildFunc != nil {
123123
return cli.imageBuildFunc(ctx, buildContext, options)
124124
}
125-
return types.ImageBuildResponse{Body: io.NopCloser(strings.NewReader(""))}, nil
125+
return build.ImageBuildResponse{Body: io.NopCloser(strings.NewReader(""))}, nil
126126
}

0 commit comments

Comments
 (0)