Skip to content

Commit 3a3fe84

Browse files
authored
Merge pull request docker#5428 from thaJeztah/bump_docker_28
vendor: github.com/docker/docker 164cae56ed95 (master, v-next)
2 parents ff853c4 + b12ac89 commit 3a3fe84

31 files changed

+241
-107
lines changed

cli/command/image/client_test.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ import (
1616
type fakeClient struct {
1717
client.Client
1818
imageTagFunc func(string, string) error
19-
imageSaveFunc func(images []string) (io.ReadCloser, error)
19+
imageSaveFunc func(images []string, options image.SaveOptions) (io.ReadCloser, error)
2020
imageRemoveFunc func(image string, options image.RemoveOptions) ([]image.DeleteResponse, error)
2121
imagePushFunc func(ref string, options image.PushOptions) (io.ReadCloser, error)
2222
infoFunc func() (system.Info, error)
2323
imagePullFunc func(ref string, options image.PullOptions) (io.ReadCloser, error)
2424
imagesPruneFunc func(pruneFilter filters.Args) (image.PruneReport, error)
25-
imageLoadFunc func(input io.Reader, quiet bool) (image.LoadResponse, error)
25+
imageLoadFunc func(input io.Reader, options image.LoadOptions) (image.LoadResponse, error)
2626
imageListFunc func(options image.ListOptions) ([]image.Summary, error)
2727
imageInspectFunc func(img string) (image.InspectResponse, []byte, error)
2828
imageImportFunc func(source image.ImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error)
29-
imageHistoryFunc func(img string) ([]image.HistoryResponseItem, error)
29+
imageHistoryFunc func(img string, options image.HistoryOptions) ([]image.HistoryResponseItem, error)
3030
imageBuildFunc func(context.Context, io.Reader, types.ImageBuildOptions) (types.ImageBuildResponse, error)
3131
}
3232

@@ -37,9 +37,9 @@ func (cli *fakeClient) ImageTag(_ context.Context, img, ref string) error {
3737
return nil
3838
}
3939

40-
func (cli *fakeClient) ImageSave(_ context.Context, images []string) (io.ReadCloser, error) {
40+
func (cli *fakeClient) ImageSave(_ context.Context, images []string, options image.SaveOptions) (io.ReadCloser, error) {
4141
if cli.imageSaveFunc != nil {
42-
return cli.imageSaveFunc(images)
42+
return cli.imageSaveFunc(images, options)
4343
}
4444
return io.NopCloser(strings.NewReader("")), nil
4545
}
@@ -81,9 +81,9 @@ func (cli *fakeClient) ImagesPrune(_ context.Context, pruneFilter filters.Args)
8181
return image.PruneReport{}, nil
8282
}
8383

84-
func (cli *fakeClient) ImageLoad(_ context.Context, input io.Reader, quiet bool) (image.LoadResponse, error) {
84+
func (cli *fakeClient) ImageLoad(_ context.Context, input io.Reader, options image.LoadOptions) (image.LoadResponse, error) {
8585
if cli.imageLoadFunc != nil {
86-
return cli.imageLoadFunc(input, quiet)
86+
return cli.imageLoadFunc(input, options)
8787
}
8888
return image.LoadResponse{}, nil
8989
}
@@ -111,9 +111,9 @@ func (cli *fakeClient) ImageImport(_ context.Context, source image.ImportSource,
111111
return io.NopCloser(strings.NewReader("")), nil
112112
}
113113

114-
func (cli *fakeClient) ImageHistory(_ context.Context, img string) ([]image.HistoryResponseItem, error) {
114+
func (cli *fakeClient) ImageHistory(_ context.Context, img string, options image.HistoryOptions) ([]image.HistoryResponseItem, error) {
115115
if cli.imageHistoryFunc != nil {
116-
return cli.imageHistoryFunc(img)
116+
return cli.imageHistoryFunc(img, options)
117117
}
118118
return []image.HistoryResponseItem{{ID: img, Created: time.Now().Unix()}}, nil
119119
}

cli/command/image/history.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/docker/cli/cli/command/completion"
99
"github.com/docker/cli/cli/command/formatter"
1010
flagsHelper "github.com/docker/cli/cli/flags"
11+
"github.com/docker/docker/api/types/image"
1112
"github.com/spf13/cobra"
1213
)
1314

@@ -49,7 +50,7 @@ func NewHistoryCommand(dockerCli command.Cli) *cobra.Command {
4950
}
5051

5152
func runHistory(ctx context.Context, dockerCli command.Cli, opts historyOptions) error {
52-
history, err := dockerCli.Client().ImageHistory(ctx, opts.image)
53+
history, err := dockerCli.Client().ImageHistory(ctx, opts.image, image.HistoryOptions{})
5354
if err != nil {
5455
return err
5556
}

cli/command/image/history_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestNewHistoryCommandErrors(t *testing.T) {
1818
name string
1919
args []string
2020
expectedError string
21-
imageHistoryFunc func(img string) ([]image.HistoryResponseItem, error)
21+
imageHistoryFunc func(img string, options image.HistoryOptions) ([]image.HistoryResponseItem, error)
2222
}{
2323
{
2424
name: "wrong-args",
@@ -29,7 +29,7 @@ func TestNewHistoryCommandErrors(t *testing.T) {
2929
name: "client-error",
3030
args: []string{"image:tag"},
3131
expectedError: "something went wrong",
32-
imageHistoryFunc: func(img string) ([]image.HistoryResponseItem, error) {
32+
imageHistoryFunc: func(img string, options image.HistoryOptions) ([]image.HistoryResponseItem, error) {
3333
return []image.HistoryResponseItem{{}}, errors.Errorf("something went wrong")
3434
},
3535
},
@@ -50,12 +50,12 @@ func TestNewHistoryCommandSuccess(t *testing.T) {
5050
testCases := []struct {
5151
name string
5252
args []string
53-
imageHistoryFunc func(img string) ([]image.HistoryResponseItem, error)
53+
imageHistoryFunc func(img string, options image.HistoryOptions) ([]image.HistoryResponseItem, error)
5454
}{
5555
{
5656
name: "simple",
5757
args: []string{"image:tag"},
58-
imageHistoryFunc: func(img string) ([]image.HistoryResponseItem, error) {
58+
imageHistoryFunc: func(img string, options image.HistoryOptions) ([]image.HistoryResponseItem, error) {
5959
return []image.HistoryResponseItem{{
6060
ID: "1234567890123456789",
6161
Created: time.Now().Unix(),
@@ -70,7 +70,7 @@ func TestNewHistoryCommandSuccess(t *testing.T) {
7070
{
7171
name: "non-human",
7272
args: []string{"--human=false", "image:tag"},
73-
imageHistoryFunc: func(img string) ([]image.HistoryResponseItem, error) {
73+
imageHistoryFunc: func(img string, options image.HistoryOptions) ([]image.HistoryResponseItem, error) {
7474
return []image.HistoryResponseItem{{
7575
ID: "abcdef",
7676
Created: time.Date(2017, 1, 1, 12, 0, 3, 0, time.UTC).Unix(),
@@ -82,7 +82,7 @@ func TestNewHistoryCommandSuccess(t *testing.T) {
8282
{
8383
name: "quiet-no-trunc",
8484
args: []string{"--quiet", "--no-trunc", "image:tag"},
85-
imageHistoryFunc: func(img string) ([]image.HistoryResponseItem, error) {
85+
imageHistoryFunc: func(img string, options image.HistoryOptions) ([]image.HistoryResponseItem, error) {
8686
return []image.HistoryResponseItem{{
8787
ID: "1234567890123456789",
8888
Created: time.Now().Unix(),

cli/command/image/load.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +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/image"
1011
"github.com/docker/docker/pkg/jsonmessage"
1112
"github.com/moby/sys/sequential"
1213
"github.com/pkg/errors"
@@ -62,10 +63,12 @@ func runLoad(ctx context.Context, dockerCli command.Cli, opts loadOptions) error
6263
return errors.Errorf("requested load from stdin, but stdin is empty")
6364
}
6465

65-
if !dockerCli.Out().IsTerminal() {
66-
opts.quiet = true
66+
var loadOpts image.LoadOptions
67+
if opts.quiet || !dockerCli.Out().IsTerminal() {
68+
loadOpts.Quiet = true
6769
}
68-
response, err := dockerCli.Client().ImageLoad(ctx, input, opts.quiet)
70+
71+
response, err := dockerCli.Client().ImageLoad(ctx, input, loadOpts)
6972
if err != nil {
7073
return err
7174
}

cli/command/image/load_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func TestNewLoadCommandErrors(t *testing.T) {
1919
args []string
2020
isTerminalIn bool
2121
expectedError string
22-
imageLoadFunc func(input io.Reader, quiet bool) (image.LoadResponse, error)
22+
imageLoadFunc func(input io.Reader, options image.LoadOptions) (image.LoadResponse, error)
2323
}{
2424
{
2525
name: "wrong-args",
@@ -34,7 +34,7 @@ func TestNewLoadCommandErrors(t *testing.T) {
3434
{
3535
name: "pull-error",
3636
expectedError: "something went wrong",
37-
imageLoadFunc: func(input io.Reader, quiet bool) (image.LoadResponse, error) {
37+
imageLoadFunc: func(input io.Reader, options image.LoadOptions) (image.LoadResponse, error) {
3838
return image.LoadResponse{}, errors.Errorf("something went wrong")
3939
},
4040
},
@@ -67,17 +67,17 @@ func TestNewLoadCommandSuccess(t *testing.T) {
6767
testCases := []struct {
6868
name string
6969
args []string
70-
imageLoadFunc func(input io.Reader, quiet bool) (image.LoadResponse, error)
70+
imageLoadFunc func(input io.Reader, options image.LoadOptions) (image.LoadResponse, error)
7171
}{
7272
{
7373
name: "simple",
74-
imageLoadFunc: func(input io.Reader, quiet bool) (image.LoadResponse, error) {
74+
imageLoadFunc: func(input io.Reader, options image.LoadOptions) (image.LoadResponse, error) {
7575
return image.LoadResponse{Body: io.NopCloser(strings.NewReader("Success"))}, nil
7676
},
7777
},
7878
{
7979
name: "json",
80-
imageLoadFunc: func(input io.Reader, quiet bool) (image.LoadResponse, error) {
80+
imageLoadFunc: func(input io.Reader, options image.LoadOptions) (image.LoadResponse, error) {
8181
json := "{\"ID\": \"1\"}"
8282
return image.LoadResponse{
8383
Body: io.NopCloser(strings.NewReader(json)),
@@ -88,7 +88,7 @@ func TestNewLoadCommandSuccess(t *testing.T) {
8888
{
8989
name: "input-file",
9090
args: []string{"--input", "testdata/load-command-success.input.txt"},
91-
imageLoadFunc: func(input io.Reader, quiet bool) (image.LoadResponse, error) {
91+
imageLoadFunc: func(input io.Reader, options image.LoadOptions) (image.LoadResponse, error) {
9292
return image.LoadResponse{Body: io.NopCloser(strings.NewReader("Success"))}, nil
9393
},
9494
},

cli/command/image/save.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +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/image"
1011
"github.com/pkg/errors"
1112
"github.com/spf13/cobra"
1213
)
@@ -51,7 +52,7 @@ func RunSave(ctx context.Context, dockerCli command.Cli, opts saveOptions) error
5152
return errors.Wrap(err, "failed to save image")
5253
}
5354

54-
responseBody, err := dockerCli.Client().ImageSave(ctx, opts.images)
55+
responseBody, err := dockerCli.Client().ImageSave(ctx, opts.images, image.SaveOptions{})
5556
if err != nil {
5657
return err
5758
}

cli/command/image/save_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"testing"
88

99
"github.com/docker/cli/internal/test"
10+
"github.com/docker/docker/api/types/image"
1011
"github.com/pkg/errors"
1112
"gotest.tools/v3/assert"
1213
is "gotest.tools/v3/assert/cmp"
@@ -18,7 +19,7 @@ func TestNewSaveCommandErrors(t *testing.T) {
1819
args []string
1920
isTerminal bool
2021
expectedError string
21-
imageSaveFunc func(images []string) (io.ReadCloser, error)
22+
imageSaveFunc func(images []string, options image.SaveOptions) (io.ReadCloser, error)
2223
}{
2324
{
2425
name: "wrong args",
@@ -36,7 +37,7 @@ func TestNewSaveCommandErrors(t *testing.T) {
3637
args: []string{"arg1"},
3738
isTerminal: false,
3839
expectedError: "error saving image",
39-
imageSaveFunc: func(images []string) (io.ReadCloser, error) {
40+
imageSaveFunc: func(images []string, options image.SaveOptions) (io.ReadCloser, error) {
4041
return io.NopCloser(strings.NewReader("")), errors.Errorf("error saving image")
4142
},
4243
},
@@ -99,7 +100,7 @@ func TestNewSaveCommandSuccess(t *testing.T) {
99100
tc := tc
100101
t.Run(strings.Join(tc.args, " "), func(t *testing.T) {
101102
cmd := NewSaveCommand(test.NewFakeCli(&fakeClient{
102-
imageSaveFunc: func(images []string) (io.ReadCloser, error) {
103+
imageSaveFunc: func(images []string, options image.SaveOptions) (io.ReadCloser, error) {
103104
return io.NopCloser(strings.NewReader("")), nil
104105
},
105106
}))

cli/command/registry.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
configtypes "github.com/docker/cli/cli/config/types"
1414
"github.com/docker/cli/cli/hints"
1515
"github.com/docker/cli/cli/streams"
16-
"github.com/docker/docker/api/types"
1716
registrytypes "github.com/docker/docker/api/types/registry"
1817
"github.com/docker/docker/registry"
1918
"github.com/pkg/errors"
@@ -25,7 +24,7 @@ const patSuggest = "You can log in with your password or a Personal Access " +
2524

2625
// RegistryAuthenticationPrivilegedFunc returns a RequestPrivilegeFunc from the specified registry index info
2726
// for the given command.
28-
func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInfo, cmdName string) types.RequestPrivilegeFunc {
27+
func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInfo, cmdName string) registrytypes.RequestAuthConfig {
2928
return func(ctx context.Context) (string, error) {
3029
fmt.Fprintf(cli.Out(), "\nLogin prior to %s:\n", cmdName)
3130
indexServer := registry.GetAuthConfigKey(index)

vendor.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require (
1313
github.com/distribution/reference v0.6.0
1414
github.com/docker/cli-docs-tool v0.8.0
1515
github.com/docker/distribution v2.8.3+incompatible
16-
github.com/docker/docker v27.0.2-0.20240808103429-2269acc7a31d+incompatible // master (v-next)
16+
github.com/docker/docker v27.0.2-0.20240912171519-164cae56ed95+incompatible // master (v-next)
1717
github.com/docker/docker-credential-helpers v0.8.2
1818
github.com/docker/go-connections v0.5.0
1919
github.com/docker/go-units v0.5.0

vendor.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ github.com/docker/cli-docs-tool v0.8.0/go.mod h1:8TQQ3E7mOXoYUs811LiPdUnAhXrcVsB
5757
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
5858
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
5959
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
60-
github.com/docker/docker v27.0.2-0.20240808103429-2269acc7a31d+incompatible h1:kkRsJYOCMGRonT/rXx/m1Cy9IryWhEe1b3CkA3q5/oA=
61-
github.com/docker/docker v27.0.2-0.20240808103429-2269acc7a31d+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
60+
github.com/docker/docker v27.0.2-0.20240912171519-164cae56ed95+incompatible h1:HRK75BHG33htes7s+v/fJ8saCNw3B7f3spcgLsvbLRQ=
61+
github.com/docker/docker v27.0.2-0.20240912171519-164cae56ed95+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
6262
github.com/docker/docker-credential-helpers v0.8.2 h1:bX3YxiGzFP5sOXWc3bTPEXdEaZSeVMrFgOr3T+zrFAo=
6363
github.com/docker/docker-credential-helpers v0.8.2/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M=
6464
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0=

vendor/github.com/docker/docker/api/common.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)