vendor: github.com/moby/moby/api, client 0769fe708773 (master)

full diff: 4ca8aedf92...0769fe7087

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-10-06 12:54:54 +02:00
parent 6ddff81bee
commit f81816ef88
175 changed files with 1514 additions and 1830 deletions

View File

@ -6,7 +6,6 @@ import (
"strings"
"time"
"github.com/moby/moby/api/types/filters"
"github.com/moby/moby/api/types/image"
"github.com/moby/moby/api/types/system"
"github.com/moby/moby/client"
@ -19,8 +18,8 @@ type fakeClient struct {
imageRemoveFunc func(image string, options client.ImageRemoveOptions) ([]image.DeleteResponse, error)
imagePushFunc func(ref string, options client.ImagePushOptions) (io.ReadCloser, error)
infoFunc func() (system.Info, error)
imagePullFunc func(ref string, options client.ImagePullOptions) (io.ReadCloser, error)
imagesPruneFunc func(pruneFilter filters.Args) (image.PruneReport, error)
imagePullFunc func(ref string, options client.ImagePullOptions) (client.ImagePullResponse, error)
imagesPruneFunc func(pruneFilter client.Filters) (image.PruneReport, error)
imageLoadFunc func(input io.Reader, options ...client.ImageLoadOption) (client.LoadResponse, error)
imageListFunc func(options client.ImageListOptions) ([]image.Summary, error)
imageInspectFunc func(img string) (image.InspectResponse, error)
@ -66,14 +65,14 @@ func (cli *fakeClient) Info(_ context.Context) (system.Info, error) {
return system.Info{}, nil
}
func (cli *fakeClient) ImagePull(_ context.Context, ref string, options client.ImagePullOptions) (io.ReadCloser, error) {
func (cli *fakeClient) ImagePull(_ context.Context, ref string, options client.ImagePullOptions) (client.ImagePullResponse, error) {
if cli.imagePullFunc != nil {
return cli.imagePullFunc(ref, options)
}
return io.NopCloser(strings.NewReader("")), nil
return client.ImagePullResponse{}, nil
}
func (cli *fakeClient) ImagesPrune(_ context.Context, pruneFilter filters.Args) (image.PruneReport, error) {
func (cli *fakeClient) ImagesPrune(_ context.Context, pruneFilter client.Filters) (image.PruneReport, error) {
if cli.imagesPruneFunc != nil {
return cli.imagesPruneFunc(pruneFilter)
}

View File

@ -11,7 +11,6 @@ import (
"github.com/moby/moby/api/types/image"
"github.com/moby/moby/client"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/golden"
)
@ -69,7 +68,7 @@ func TestNewImagesCommandSuccess(t *testing.T) {
name: "match-name",
args: []string{"image"},
imageListFunc: func(options client.ImageListOptions) ([]image.Summary, error) {
assert.Check(t, is.Equal("image", options.Filters.Get("reference")[0]))
assert.Check(t, options.Filters["reference"]["image"])
return []image.Summary{}, nil
},
},
@ -77,7 +76,7 @@ func TestNewImagesCommandSuccess(t *testing.T) {
name: "filters",
args: []string{"--filter", "name=value"},
imageListFunc: func(options client.ImageListOptions) ([]image.Summary, error) {
assert.Check(t, is.Equal("value", options.Filters.Get("name")[0]))
assert.Check(t, options.Filters["name"]["value"])
return []image.Summary{}, nil
},
},

View File

@ -69,9 +69,8 @@ Are you sure you want to continue?`
)
func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions) (spaceReclaimed uint64, output string, err error) {
pruneFilters := options.filter.Value().Clone()
pruneFilters := command.PruneFilters(dockerCli, options.filter.Value())
pruneFilters.Add("dangling", strconv.FormatBool(!options.all))
pruneFilters = command.PruneFilters(dockerCli, pruneFilters)
warning := danglingWarning
if options.all {

View File

@ -10,10 +10,9 @@ import (
"github.com/docker/cli/cli/streams"
"github.com/docker/cli/internal/test"
"github.com/moby/moby/api/types/filters"
"github.com/moby/moby/api/types/image"
"github.com/moby/moby/client"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/golden"
)
@ -22,7 +21,7 @@ func TestNewPruneCommandErrors(t *testing.T) {
name string
args []string
expectedError string
imagesPruneFunc func(pruneFilter filters.Args) (image.PruneReport, error)
imagesPruneFunc func(pruneFilter client.Filters) (image.PruneReport, error)
}{
{
name: "wrong-args",
@ -33,7 +32,7 @@ func TestNewPruneCommandErrors(t *testing.T) {
name: "prune-error",
args: []string{"--force"},
expectedError: "something went wrong",
imagesPruneFunc: func(pruneFilter filters.Args) (image.PruneReport, error) {
imagesPruneFunc: func(pruneFilter client.Filters) (image.PruneReport, error) {
return image.PruneReport{}, errors.New("something went wrong")
},
},
@ -55,21 +54,21 @@ func TestNewPruneCommandSuccess(t *testing.T) {
testCases := []struct {
name string
args []string
imagesPruneFunc func(pruneFilter filters.Args) (image.PruneReport, error)
imagesPruneFunc func(pruneFilter client.Filters) (image.PruneReport, error)
}{
{
name: "all",
args: []string{"--all"},
imagesPruneFunc: func(pruneFilter filters.Args) (image.PruneReport, error) {
assert.Check(t, is.Equal("false", pruneFilter.Get("dangling")[0]))
imagesPruneFunc: func(pruneFilter client.Filters) (image.PruneReport, error) {
assert.Check(t, pruneFilter["dangling"]["false"])
return image.PruneReport{}, nil
},
},
{
name: "force-deleted",
args: []string{"--force"},
imagesPruneFunc: func(pruneFilter filters.Args) (image.PruneReport, error) {
assert.Check(t, is.Equal("true", pruneFilter.Get("dangling")[0]))
imagesPruneFunc: func(pruneFilter client.Filters) (image.PruneReport, error) {
assert.Check(t, pruneFilter["dangling"]["true"])
return image.PruneReport{
ImagesDeleted: []image.DeleteResponse{{Deleted: "image1"}},
SpaceReclaimed: 1,
@ -79,16 +78,16 @@ func TestNewPruneCommandSuccess(t *testing.T) {
{
name: "label-filter",
args: []string{"--force", "--filter", "label=foobar"},
imagesPruneFunc: func(pruneFilter filters.Args) (image.PruneReport, error) {
assert.Check(t, is.Equal("foobar", pruneFilter.Get("label")[0]))
imagesPruneFunc: func(pruneFilter client.Filters) (image.PruneReport, error) {
assert.Check(t, pruneFilter["label"]["foobar"])
return image.PruneReport{}, nil
},
},
{
name: "force-untagged",
args: []string{"--force"},
imagesPruneFunc: func(pruneFilter filters.Args) (image.PruneReport, error) {
assert.Check(t, is.Equal("true", pruneFilter.Get("dangling")[0]))
imagesPruneFunc: func(pruneFilter client.Filters) (image.PruneReport, error) {
assert.Check(t, pruneFilter["dangling"]["true"])
return image.PruneReport{
ImagesDeleted: []image.DeleteResponse{{Untagged: "image1"}},
SpaceReclaimed: 2,
@ -117,7 +116,7 @@ func TestPrunePromptTermination(t *testing.T) {
t.Cleanup(cancel)
cli := test.NewFakeCli(&fakeClient{
imagesPruneFunc: func(pruneFilter filters.Args) (image.PruneReport, error) {
imagesPruneFunc: func(pruneFilter client.Filters) (image.PruneReport, error) {
return image.PruneReport{}, errors.New("fakeClient imagesPruneFunc should not be called")
},
})

View File

@ -4,7 +4,6 @@ import (
"errors"
"fmt"
"io"
"strings"
"testing"
"github.com/docker/cli/internal/test"
@ -74,9 +73,9 @@ func TestNewPullCommandSuccess(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
cli := test.NewFakeCli(&fakeClient{
imagePullFunc: func(ref string, options client.ImagePullOptions) (io.ReadCloser, error) {
imagePullFunc: func(ref string, options client.ImagePullOptions) (client.ImagePullResponse, error) {
assert.Check(t, is.Equal(tc.expectedTag, ref), tc.name)
return io.NopCloser(strings.NewReader("")), nil
return client.ImagePullResponse{}, nil
},
})
cmd := newPullCommand(cli)
@ -120,8 +119,8 @@ func TestNewPullCommandWithContentTrustErrors(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
t.Setenv("DOCKER_CONTENT_TRUST", "true")
cli := test.NewFakeCli(&fakeClient{
imagePullFunc: func(ref string, options client.ImagePullOptions) (io.ReadCloser, error) {
return io.NopCloser(strings.NewReader("")), errors.New("shouldn't try to pull image")
imagePullFunc: func(ref string, options client.ImagePullOptions) (client.ImagePullResponse, error) {
return client.ImagePullResponse{}, errors.New("shouldn't try to pull image")
},
})
cli.SetNotaryClient(tc.notaryFunc)

View File

@ -3,10 +3,6 @@
"Id": "",
"RepoTags": null,
"RepoDigests": null,
"Parent": "",
"Comment": "",
"DockerVersion": "",
"Author": "",
"Config": null,
"Architecture": "",
"Os": "",
@ -20,10 +16,6 @@
"Id": "",
"RepoTags": null,
"RepoDigests": null,
"Parent": "",
"Comment": "",
"DockerVersion": "",
"Author": "",
"Config": null,
"Architecture": "",
"Os": "",

View File

@ -3,10 +3,6 @@
"Id": "",
"RepoTags": null,
"RepoDigests": null,
"Parent": "",
"Comment": "",
"DockerVersion": "",
"Author": "",
"Config": null,
"Architecture": "",
"Os": "",

View File

@ -17,7 +17,6 @@ import (
"github.com/docker/cli/cli/streams"
"github.com/docker/cli/internal/tui"
"github.com/docker/go-units"
"github.com/moby/moby/api/types/filters"
imagetypes "github.com/moby/moby/api/types/image"
"github.com/moby/moby/client"
"github.com/morikuni/aec"
@ -26,7 +25,7 @@ import (
type treeOptions struct {
all bool
filters filters.Args
filters client.Filters
}
type treeView struct {