Skip to content

Commit de0d30f

Browse files
authored
Merge pull request #4010 from thaJeztah/update_engine_23.1
vendor: update docker/docker to master (v24.0.0-dev)
2 parents 92fb47f + 7189716 commit de0d30f

File tree

220 files changed

+3112
-2309
lines changed

Some content is hidden

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

220 files changed

+3112
-2309
lines changed

cli/command/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func (cli *DockerCli) ManifestStore() manifeststore.Store {
191191
// RegistryClient returns a client for communicating with a Docker distribution
192192
// registry
193193
func (cli *DockerCli) RegistryClient(allowInsecure bool) registryclient.RegistryClient {
194-
resolver := func(ctx context.Context, index *registry.IndexInfo) types.AuthConfig {
194+
resolver := func(ctx context.Context, index *registry.IndexInfo) registry.AuthConfig {
195195
return ResolveAuthConfig(ctx, cli, index)
196196
}
197197
return registryclient.NewRegistryClient(resolver, UserAgent(), allowInsecure)

cli/command/completion/functions.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +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/filters"
9+
"github.com/docker/docker/api/types/volume"
1010
"github.com/spf13/cobra"
1111
)
1212

@@ -66,13 +66,13 @@ func ContainerNames(dockerCli command.Cli, all bool, filters ...func(types.Conta
6666
// VolumeNames offers completion for volumes
6767
func VolumeNames(dockerCli command.Cli) ValidArgsFn {
6868
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
69-
list, err := dockerCli.Client().VolumeList(cmd.Context(), filters.Args{})
69+
list, err := dockerCli.Client().VolumeList(cmd.Context(), volume.ListOptions{})
7070
if err != nil {
7171
return nil, cobra.ShellCompDirectiveError
7272
}
7373
var names []string
74-
for _, volume := range list.Volumes {
75-
names = append(names, volume.Name)
74+
for _, vol := range list.Volumes {
75+
names = append(names, vol.Name)
7676
}
7777
return names, cobra.ShellCompDirectiveNoFileComp
7878
}

cli/command/container/cp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func resolveLocalPath(localPath string) (absPath string, err error) {
153153
if absPath, err = filepath.Abs(localPath); err != nil {
154154
return
155155
}
156-
return archive.PreserveTrailingDotOrSeparator(absPath, localPath, filepath.Separator), nil
156+
return archive.PreserveTrailingDotOrSeparator(absPath, localPath), nil
157157
}
158158

159159
func copyFromContainer(ctx context.Context, dockerCli command.Cli, copyConfig cpConfig) (err error) {

cli/command/image/build.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"github.com/docker/docker/api"
2323
"github.com/docker/docker/api/types"
2424
"github.com/docker/docker/api/types/container"
25+
registrytypes "github.com/docker/docker/api/types/registry"
2526
"github.com/docker/docker/builder/remotecontext/urlutil"
2627
"github.com/docker/docker/pkg/archive"
2728
"github.com/docker/docker/pkg/idtools"
@@ -322,9 +323,9 @@ func runBuild(dockerCli command.Cli, options buildOptions) error {
322323

323324
configFile := dockerCli.ConfigFile()
324325
creds, _ := configFile.GetAllCredentials()
325-
authConfigs := make(map[string]types.AuthConfig, len(creds))
326+
authConfigs := make(map[string]registrytypes.AuthConfig, len(creds))
326327
for k, auth := range creds {
327-
authConfigs[k] = types.AuthConfig(auth)
328+
authConfigs[k] = registrytypes.AuthConfig(auth)
328329
}
329330
buildOptions := imageBuildOptions(dockerCli, options)
330331
buildOptions.Version = types.BuilderV1

cli/command/image/trust.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type target struct {
3030
}
3131

3232
// TrustedPush handles content trust pushing of an image
33-
func TrustedPush(ctx context.Context, cli command.Cli, repoInfo *registry.RepositoryInfo, ref reference.Named, authConfig types.AuthConfig, options types.ImagePushOptions) error {
33+
func TrustedPush(ctx context.Context, cli command.Cli, repoInfo *registry.RepositoryInfo, ref reference.Named, authConfig registrytypes.AuthConfig, options types.ImagePushOptions) error {
3434
responseBody, err := cli.Client().ImagePush(ctx, reference.FamiliarString(ref), options)
3535
if err != nil {
3636
return err
@@ -44,7 +44,7 @@ func TrustedPush(ctx context.Context, cli command.Cli, repoInfo *registry.Reposi
4444
// PushTrustedReference pushes a canonical reference to the trust server.
4545
//
4646
//nolint:gocyclo
47-
func PushTrustedReference(streams command.Streams, repoInfo *registry.RepositoryInfo, ref reference.Named, authConfig types.AuthConfig, in io.Reader) error {
47+
func PushTrustedReference(streams command.Streams, repoInfo *registry.RepositoryInfo, ref reference.Named, authConfig registrytypes.AuthConfig, in io.Reader) error {
4848
// If it is a trusted push we would like to find the target entry which match the
4949
// tag provided in the function and then do an AddTarget later.
5050
target := &client.Target{}
@@ -340,8 +340,8 @@ func TagTrusted(ctx context.Context, cli command.Cli, trustedRef reference.Canon
340340
}
341341

342342
// AuthResolver returns an auth resolver function from a command.Cli
343-
func AuthResolver(cli command.Cli) func(ctx context.Context, index *registrytypes.IndexInfo) types.AuthConfig {
344-
return func(ctx context.Context, index *registrytypes.IndexInfo) types.AuthConfig {
343+
func AuthResolver(cli command.Cli) func(ctx context.Context, index *registrytypes.IndexInfo) registrytypes.AuthConfig {
344+
return func(ctx context.Context, index *registrytypes.IndexInfo) registrytypes.AuthConfig {
345345
return command.ResolveAuthConfig(ctx, cli, index)
346346
}
347347
}

cli/command/registry.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
)
2323

2424
// EncodeAuthToBase64 serializes the auth configuration as JSON base64 payload
25-
func EncodeAuthToBase64(authConfig types.AuthConfig) (string, error) {
25+
func EncodeAuthToBase64(authConfig registrytypes.AuthConfig) (string, error) {
2626
buf, err := json.Marshal(authConfig)
2727
if err != nil {
2828
return "", err
@@ -52,19 +52,19 @@ func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInf
5252
// ResolveAuthConfig is like registry.ResolveAuthConfig, but if using the
5353
// default index, it uses the default index name for the daemon's platform,
5454
// not the client's platform.
55-
func ResolveAuthConfig(_ context.Context, cli Cli, index *registrytypes.IndexInfo) types.AuthConfig {
55+
func ResolveAuthConfig(_ context.Context, cli Cli, index *registrytypes.IndexInfo) registrytypes.AuthConfig {
5656
configKey := index.Name
5757
if index.Official {
5858
configKey = registry.IndexServer
5959
}
6060

6161
a, _ := cli.ConfigFile().GetAuthConfig(configKey)
62-
return types.AuthConfig(a)
62+
return registrytypes.AuthConfig(a)
6363
}
6464

6565
// GetDefaultAuthConfig gets the default auth config given a serverAddress
6666
// If credentials for given serverAddress exists in the credential store, the configuration will be populated with values in it
67-
func GetDefaultAuthConfig(cli Cli, checkCredStore bool, serverAddress string, isDefaultRegistry bool) (types.AuthConfig, error) {
67+
func GetDefaultAuthConfig(cli Cli, checkCredStore bool, serverAddress string, isDefaultRegistry bool) (registrytypes.AuthConfig, error) {
6868
if !isDefaultRegistry {
6969
serverAddress = registry.ConvertToHostname(serverAddress)
7070
}
@@ -73,19 +73,19 @@ func GetDefaultAuthConfig(cli Cli, checkCredStore bool, serverAddress string, is
7373
if checkCredStore {
7474
authconfig, err = cli.ConfigFile().GetAuthConfig(serverAddress)
7575
if err != nil {
76-
return types.AuthConfig{
76+
return registrytypes.AuthConfig{
7777
ServerAddress: serverAddress,
7878
}, err
7979
}
8080
}
8181
authconfig.ServerAddress = serverAddress
8282
authconfig.IdentityToken = ""
83-
res := types.AuthConfig(authconfig)
83+
res := registrytypes.AuthConfig(authconfig)
8484
return res, nil
8585
}
8686

8787
// ConfigureAuth handles prompting of user's username and password if needed
88-
func ConfigureAuth(cli Cli, flUser, flPassword string, authconfig *types.AuthConfig, isDefaultRegistry bool) error {
88+
func ConfigureAuth(cli Cli, flUser, flPassword string, authconfig *registrytypes.AuthConfig, isDefaultRegistry bool) error {
8989
// On Windows, force the use of the regular OS stdin stream. Fixes #14336/#14210
9090
if runtime.GOOS == "windows" {
9191
cli.SetIn(streams.NewIn(os.Stdin))
@@ -175,14 +175,14 @@ func RetrieveAuthTokenFromImage(ctx context.Context, cli Cli, image string) (str
175175
}
176176

177177
// resolveAuthConfigFromImage retrieves that AuthConfig using the image string
178-
func resolveAuthConfigFromImage(ctx context.Context, cli Cli, image string) (types.AuthConfig, error) {
178+
func resolveAuthConfigFromImage(ctx context.Context, cli Cli, image string) (registrytypes.AuthConfig, error) {
179179
registryRef, err := reference.ParseNormalizedNamed(image)
180180
if err != nil {
181-
return types.AuthConfig{}, err
181+
return registrytypes.AuthConfig{}, err
182182
}
183183
repoInfo, err := registry.ParseRepositoryInfo(registryRef)
184184
if err != nil {
185-
return types.AuthConfig{}, err
185+
return registrytypes.AuthConfig{}, err
186186
}
187187
return ResolveAuthConfig(ctx, cli, repoInfo.Index), nil
188188
}

cli/command/registry/login.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/docker/cli/cli/command"
1111
"github.com/docker/cli/cli/command/completion"
1212
configtypes "github.com/docker/cli/cli/config/types"
13-
"github.com/docker/docker/api/types"
1413
registrytypes "github.com/docker/docker/api/types/registry"
1514
"github.com/docker/docker/client"
1615
"github.com/docker/docker/errdefs"
@@ -164,7 +163,7 @@ func runLogin(dockerCli command.Cli, opts loginOptions) error { //nolint:gocyclo
164163
return nil
165164
}
166165

167-
func loginWithCredStoreCreds(ctx context.Context, dockerCli command.Cli, authConfig *types.AuthConfig) (registrytypes.AuthenticateOKBody, error) {
166+
func loginWithCredStoreCreds(ctx context.Context, dockerCli command.Cli, authConfig *registrytypes.AuthConfig) (registrytypes.AuthenticateOKBody, error) {
168167
fmt.Fprintf(dockerCli.Out(), "Authenticating with existing credentials...\n")
169168
cliClient := dockerCli.Client()
170169
response, err := cliClient.RegistryLogin(ctx, *authConfig)
@@ -178,7 +177,7 @@ func loginWithCredStoreCreds(ctx context.Context, dockerCli command.Cli, authCon
178177
return response, err
179178
}
180179

181-
func loginClientSide(ctx context.Context, auth types.AuthConfig) (registrytypes.AuthenticateOKBody, error) {
180+
func loginClientSide(ctx context.Context, auth registrytypes.AuthConfig) (registrytypes.AuthenticateOKBody, error) {
182181
svc, err := registry.NewService(registry.ServiceOptions{})
183182
if err != nil {
184183
return registrytypes.AuthenticateOKBody{}, err

cli/command/registry/login_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func (c fakeClient) Info(context.Context) (types.Info, error) {
3838
return types.Info{}, nil
3939
}
4040

41-
func (c fakeClient) RegistryLogin(_ context.Context, auth types.AuthConfig) (registrytypes.AuthenticateOKBody, error) {
41+
func (c fakeClient) RegistryLogin(_ context.Context, auth registrytypes.AuthConfig) (registrytypes.AuthenticateOKBody, error) {
4242
if auth.Password == expiredPassword {
4343
return registrytypes.AuthenticateOKBody{}, fmt.Errorf("Invalid Username or Password")
4444
}
@@ -53,16 +53,16 @@ func (c fakeClient) RegistryLogin(_ context.Context, auth types.AuthConfig) (reg
5353

5454
func TestLoginWithCredStoreCreds(t *testing.T) {
5555
testCases := []struct {
56-
inputAuthConfig types.AuthConfig
56+
inputAuthConfig registrytypes.AuthConfig
5757
expectedMsg string
5858
expectedErr string
5959
}{
6060
{
61-
inputAuthConfig: types.AuthConfig{},
61+
inputAuthConfig: registrytypes.AuthConfig{},
6262
expectedMsg: "Authenticating with existing credentials...\n",
6363
},
6464
{
65-
inputAuthConfig: types.AuthConfig{
65+
inputAuthConfig: registrytypes.AuthConfig{
6666
Username: userErr,
6767
},
6868
expectedMsg: "Authenticating with existing credentials...\n",

cli/command/registry_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
configtypes "github.com/docker/cli/cli/config/types"
1111
"github.com/docker/cli/internal/test"
1212
"github.com/docker/docker/api/types"
13+
"github.com/docker/docker/api/types/registry"
1314
"github.com/docker/docker/client"
1415
"gotest.tools/v3/assert"
1516
is "gotest.tools/v3/assert/cmp"
@@ -20,7 +21,7 @@ type fakeClient struct {
2021
infoFunc func() (types.Info, error)
2122
}
2223

23-
var testAuthConfigs = []types.AuthConfig{
24+
var testAuthConfigs = []registry.AuthConfig{
2425
{
2526
ServerAddress: "https://index.docker.io/v1/",
2627
Username: "u0",
@@ -45,13 +46,13 @@ func TestGetDefaultAuthConfig(t *testing.T) {
4546
checkCredStore bool
4647
inputServerAddress string
4748
expectedErr string
48-
expectedAuthConfig types.AuthConfig
49+
expectedAuthConfig registry.AuthConfig
4950
}{
5051
{
5152
checkCredStore: false,
5253
inputServerAddress: "",
5354
expectedErr: "",
54-
expectedAuthConfig: types.AuthConfig{
55+
expectedAuthConfig: registry.AuthConfig{
5556
ServerAddress: "",
5657
Username: "",
5758
Password: "",
@@ -101,7 +102,7 @@ func TestGetDefaultAuthConfig_HelperError(t *testing.T) {
101102
cli.SetErr(errBuf)
102103
cli.ConfigFile().CredentialsStore = "fake-does-not-exist"
103104
serverAddress := "test-server-address"
104-
expectedAuthConfig := types.AuthConfig{
105+
expectedAuthConfig := registry.AuthConfig{
105106
ServerAddress: serverAddress,
106107
}
107108
authconfig, err := GetDefaultAuthConfig(cli, true, serverAddress, serverAddress == "https://index.docker.io/v1/")

cli/command/volume/client_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ func (c *fakeClient) VolumeInspect(_ context.Context, volumeID string) (volume.V
3232
return volume.Volume{}, nil
3333
}
3434

35-
func (c *fakeClient) VolumeList(_ context.Context, filter filters.Args) (volume.ListResponse, error) {
35+
func (c *fakeClient) VolumeList(_ context.Context, options volume.ListOptions) (volume.ListResponse, error) {
3636
if c.volumeListFunc != nil {
37-
return c.volumeListFunc(filter)
37+
return c.volumeListFunc(options.Filters)
3838
}
3939
return volume.ListResponse{}, nil
4040
}

0 commit comments

Comments
 (0)