vendor: github.com/moby/moby/api, github.com/moby/moby/client master

full diffs:

- https://github.com/moby/moby/compare/api/v1.52.0-beta.1...e98849831fc4e35bdc09ed31b85f91caa87a0103
- https://github.com/moby/moby/compare/client/v0.1.0-beta.0...e98849831fc4e35bdc09ed31b85f91caa87a0103

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-09-19 16:30:55 +02:00
parent e241f53ebc
commit c5cbb3e648
59 changed files with 292 additions and 464 deletions

View File

@ -15,8 +15,8 @@ import (
type fakeClient struct {
client.Client
inspectFunc func(string) (container.InspectResponse, error)
execInspectFunc func(execID string) (container.ExecInspect, error)
execCreateFunc func(containerID string, options container.ExecOptions) (container.ExecCreateResponse, error)
execInspectFunc func(execID string) (client.ExecInspect, error)
execCreateFunc func(containerID string, options client.ExecCreateOptions) (container.ExecCreateResponse, error)
createContainerFunc func(config *container.Config,
hostConfig *container.HostConfig,
networkingConfig *network.NetworkingConfig,
@ -59,21 +59,21 @@ func (f *fakeClient) ContainerInspect(_ context.Context, containerID string) (co
return container.InspectResponse{}, nil
}
func (f *fakeClient) ContainerExecCreate(_ context.Context, containerID string, config container.ExecOptions) (container.ExecCreateResponse, error) {
func (f *fakeClient) ContainerExecCreate(_ context.Context, containerID string, config client.ExecCreateOptions) (container.ExecCreateResponse, error) {
if f.execCreateFunc != nil {
return f.execCreateFunc(containerID, config)
}
return container.ExecCreateResponse{}, nil
}
func (f *fakeClient) ContainerExecInspect(_ context.Context, execID string) (container.ExecInspect, error) {
func (f *fakeClient) ContainerExecInspect(_ context.Context, execID string) (client.ExecInspect, error) {
if f.execInspectFunc != nil {
return f.execInspectFunc(execID)
}
return container.ExecInspect{}, nil
return client.ExecInspect{}, nil
}
func (*fakeClient) ContainerExecStart(context.Context, string, container.ExecStartOptions) error {
func (*fakeClient) ContainerExecStart(context.Context, string, client.ExecStartOptions) error {
return nil
}

View File

@ -75,7 +75,7 @@ func runCommit(ctx context.Context, dockerCli command.Cli, options *commitOption
Comment: options.comment,
Author: options.author,
Changes: options.changes.GetSlice(),
Pause: !options.noPause,
NoPause: options.noPause,
})
if err != nil {
return err

View File

@ -23,7 +23,7 @@ func TestRunCommit(t *testing.T) {
assert.Check(t, is.Equal(options.Author, "Author Name <author@name.com>"))
assert.Check(t, is.DeepEqual(options.Changes, []string{"EXPOSE 80"}))
assert.Check(t, is.Equal(options.Comment, "commit message"))
assert.Check(t, is.Equal(options.Pause, false))
assert.Check(t, is.Equal(options.NoPause, true))
assert.Check(t, is.Equal(ctr, "container-id"))
return container.CommitResponse{ID: "image-id"}, nil

View File

@ -119,7 +119,7 @@ func RunExec(ctx context.Context, dockerCLI command.Cli, containerIDorName strin
}
if options.Detach {
return apiClient.ContainerExecStart(ctx, execID, container.ExecStartOptions{
return apiClient.ContainerExecStart(ctx, execID, client.ExecStartOptions{
Detach: options.Detach,
Tty: execOptions.Tty,
ConsoleSize: execOptions.ConsoleSize,
@ -128,14 +128,14 @@ func RunExec(ctx context.Context, dockerCLI command.Cli, containerIDorName strin
return interactiveExec(ctx, dockerCLI, execOptions, execID)
}
func fillConsoleSize(execOptions *container.ExecOptions, dockerCli command.Cli) {
func fillConsoleSize(execOptions *client.ExecCreateOptions, dockerCli command.Cli) {
if execOptions.Tty {
height, width := dockerCli.Out().GetTtySize()
execOptions.ConsoleSize = &[2]uint{height, width}
}
}
func interactiveExec(ctx context.Context, dockerCli command.Cli, execOptions *container.ExecOptions, execID string) error {
func interactiveExec(ctx context.Context, dockerCli command.Cli, execOptions *client.ExecCreateOptions, execID string) error {
// Interactive exec requested.
var (
out, stderr io.Writer
@ -158,7 +158,7 @@ func interactiveExec(ctx context.Context, dockerCli command.Cli, execOptions *co
fillConsoleSize(execOptions, dockerCli)
apiClient := dockerCli.Client()
resp, err := apiClient.ContainerExecAttach(ctx, execID, container.ExecAttachOptions{
resp, err := apiClient.ContainerExecAttach(ctx, execID, client.ExecAttachOptions{
Tty: execOptions.Tty,
ConsoleSize: execOptions.ConsoleSize,
})
@ -218,8 +218,8 @@ func getExecExitStatus(ctx context.Context, apiClient client.ContainerAPIClient,
// parseExec parses the specified args for the specified command and generates
// an ExecConfig from it.
func parseExec(execOpts ExecOptions, configFile *configfile.ConfigFile) (*container.ExecOptions, error) {
execOptions := &container.ExecOptions{
func parseExec(execOpts ExecOptions, configFile *configfile.ConfigFile) (*client.ExecCreateOptions, error) {
execOptions := &client.ExecCreateOptions{
User: execOpts.User,
Privileged: execOpts.Privileged,
Tty: execOpts.TTY,

View File

@ -13,6 +13,7 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/cli/opts"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/client"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/fs"
@ -38,10 +39,10 @@ TWO=2
testcases := []struct {
options ExecOptions
configFile configfile.ConfigFile
expected container.ExecOptions
expected client.ExecCreateOptions
}{
{
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
Cmd: []string{"command"},
AttachStdout: true,
AttachStderr: true,
@ -49,7 +50,7 @@ TWO=2
options: withDefaultOpts(ExecOptions{}),
},
{
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
Cmd: []string{"command1", "command2"},
AttachStdout: true,
AttachStderr: true,
@ -64,7 +65,7 @@ TWO=2
TTY: true,
User: "uid",
}),
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
User: "uid",
AttachStdin: true,
AttachStdout: true,
@ -75,7 +76,7 @@ TWO=2
},
{
options: withDefaultOpts(ExecOptions{Detach: true}),
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
Cmd: []string{"command"},
},
},
@ -85,7 +86,7 @@ TWO=2
Interactive: true,
Detach: true,
}),
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
Tty: true,
Cmd: []string{"command"},
},
@ -93,7 +94,7 @@ TWO=2
{
options: withDefaultOpts(ExecOptions{Detach: true}),
configFile: configfile.ConfigFile{DetachKeys: "de"},
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
Cmd: []string{"command"},
DetachKeys: "de",
},
@ -104,13 +105,13 @@ TWO=2
DetachKeys: "ab",
}),
configFile: configfile.ConfigFile{DetachKeys: "de"},
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
Cmd: []string{"command"},
DetachKeys: "ab",
},
},
{
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
Cmd: []string{"command"},
AttachStdout: true,
AttachStderr: true,
@ -123,7 +124,7 @@ TWO=2
}(),
},
{
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
Cmd: []string{"command"},
AttachStdout: true,
AttachStderr: true,
@ -206,7 +207,7 @@ func TestRunExec(t *testing.T) {
}
}
func execCreateWithID(_ string, _ container.ExecOptions) (container.ExecCreateResponse, error) {
func execCreateWithID(_ string, _ client.ExecCreateOptions) (container.ExecCreateResponse, error) {
return container.ExecCreateResponse{ID: "execid"}, nil
}
@ -235,9 +236,9 @@ func TestGetExecExitStatus(t *testing.T) {
for _, testcase := range testcases {
apiClient := &fakeClient{
execInspectFunc: func(id string) (container.ExecInspect, error) {
execInspectFunc: func(id string) (client.ExecInspect, error) {
assert.Check(t, is.Equal(execID, id))
return container.ExecInspect{ExitCode: testcase.exitCode}, testcase.inspectError
return client.ExecInspect{ExitCode: testcase.exitCode}, testcase.inspectError
},
}
err := getExecExitStatus(context.Background(), apiClient, execID)