Skip to content

Commit

Permalink
Merge pull request #5754 from thaJeztah/bump_engine
Browse files Browse the repository at this point in the history
vendor: github.com/docker/docker 6c3797923dcb (master, v28.0-dev)
  • Loading branch information
vvoland authored Feb 6, 2025
2 parents 11999b1 + 01da8a5 commit c962084
Show file tree
Hide file tree
Showing 84 changed files with 1,258 additions and 287 deletions.
5 changes: 3 additions & 2 deletions cli/command/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,16 @@ func TestNewAPIClientFromFlagsWithCustomHeadersFromEnv(t *testing.T) {
}

func TestNewAPIClientFromFlagsWithAPIVersionFromEnv(t *testing.T) {
customVersion := "v3.3.3"
const customVersion = "v3.3.3"
const expectedVersion = "3.3.3"
t.Setenv("DOCKER_API_VERSION", customVersion)
t.Setenv("DOCKER_HOST", ":2375")

opts := &flags.ClientOptions{}
configFile := &configfile.ConfigFile{}
apiclient, err := NewAPIClientFromFlags(opts, configFile)
assert.NilError(t, err)
assert.Equal(t, apiclient.ClientVersion(), customVersion)
assert.Equal(t, apiclient.ClientVersion(), expectedVersion)
}

type fakeClient struct {
Expand Down
6 changes: 3 additions & 3 deletions cli/command/image/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type fakeClient struct {
imagesPruneFunc func(pruneFilter filters.Args) (image.PruneReport, error)
imageLoadFunc func(input io.Reader, options image.LoadOptions) (image.LoadResponse, error)
imageListFunc func(options image.ListOptions) ([]image.Summary, error)
imageInspectFunc func(img string) (image.InspectResponse, []byte, error)
imageInspectFunc func(img string) (image.InspectResponse, error)
imageImportFunc func(source image.ImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error)
imageHistoryFunc func(img string, options image.HistoryOptions) ([]image.HistoryResponseItem, error)
imageBuildFunc func(context.Context, io.Reader, types.ImageBuildOptions) (types.ImageBuildResponse, error)
Expand Down Expand Up @@ -95,11 +95,11 @@ func (cli *fakeClient) ImageList(_ context.Context, options image.ListOptions) (
return []image.Summary{}, nil
}

func (cli *fakeClient) ImageInspectWithRaw(_ context.Context, img string) (image.InspectResponse, []byte, error) {
func (cli *fakeClient) ImageInspect(_ context.Context, img string, _ ...client.ImageInspectOption) (image.InspectResponse, error) {
if cli.imageInspectFunc != nil {
return cli.imageInspectFunc(img)
}
return image.InspectResponse{}, nil, nil
return image.InspectResponse{}, nil
}

func (cli *fakeClient) ImageImport(_ context.Context, source image.ImportSource, ref string,
Expand Down
10 changes: 9 additions & 1 deletion cli/command/image/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
package image

import (
"bytes"
"context"

"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/inspect"
flagsHelper "github.com/docker/cli/cli/flags"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/client"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -42,6 +45,11 @@ func newInspectCommand(dockerCli command.Cli) *cobra.Command {
func runInspect(ctx context.Context, dockerCLI command.Cli, opts inspectOptions) error {
apiClient := dockerCLI.Client()
return inspect.Inspect(dockerCLI.Out(), opts.refs, opts.format, func(ref string) (any, []byte, error) {
return apiClient.ImageInspectWithRaw(ctx, ref)
var buf bytes.Buffer
resp, err := apiClient.ImageInspect(ctx, ref, client.ImageInspectWithRawResponse(&buf))
if err != nil {
return image.InspectResponse{}, nil, err
}
return resp, buf.Bytes(), err
})
}
14 changes: 7 additions & 7 deletions cli/command/image/inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,39 +41,39 @@ func TestNewInspectCommandSuccess(t *testing.T) {
name string
args []string
imageCount int
imageInspectFunc func(img string) (image.InspectResponse, []byte, error)
imageInspectFunc func(img string) (image.InspectResponse, error)
}{
{
name: "simple",
args: []string{"image"},
imageCount: 1,
imageInspectFunc: func(img string) (image.InspectResponse, []byte, error) {
imageInspectFunc: func(img string) (image.InspectResponse, error) {
imageInspectInvocationCount++
assert.Check(t, is.Equal("image", img))
return image.InspectResponse{}, nil, nil
return image.InspectResponse{}, nil
},
},
{
name: "format",
imageCount: 1,
args: []string{"--format='{{.ID}}'", "image"},
imageInspectFunc: func(img string) (image.InspectResponse, []byte, error) {
imageInspectFunc: func(img string) (image.InspectResponse, error) {
imageInspectInvocationCount++
return image.InspectResponse{ID: img}, nil, nil
return image.InspectResponse{ID: img}, nil
},
},
{
name: "simple-many",
args: []string{"image1", "image2"},
imageCount: 2,
imageInspectFunc: func(img string) (image.InspectResponse, []byte, error) {
imageInspectFunc: func(img string) (image.InspectResponse, error) {
imageInspectInvocationCount++
if imageInspectInvocationCount == 1 {
assert.Check(t, is.Equal("image1", img))
} else {
assert.Check(t, is.Equal("image2", img))
}
return image.InspectResponse{}, nil, nil
return image.InspectResponse{}, nil
},
},
}
Expand Down
10 changes: 9 additions & 1 deletion cli/command/system/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package system

import (
"bytes"
"context"
"fmt"
"strings"
Expand All @@ -13,7 +14,9 @@ import (
"github.com/docker/cli/cli/command/inspect"
flagsHelper "github.com/docker/cli/cli/flags"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/client"
"github.com/docker/docker/errdefs"
"github.com/pkg/errors"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -67,7 +70,12 @@ func inspectContainers(ctx context.Context, dockerCli command.Cli, getSize bool)

func inspectImages(ctx context.Context, dockerCli command.Cli) inspect.GetRefFunc {
return func(ref string) (any, []byte, error) {
return dockerCli.Client().ImageInspectWithRaw(ctx, ref)
var buf bytes.Buffer
resp, err := dockerCli.Client().ImageInspect(ctx, ref, client.ImageInspectWithRawResponse(&buf))
if err != nil {
return image.InspectResponse{}, nil, err
}
return resp, buf.Bytes(), err
}
}

Expand Down
4 changes: 2 additions & 2 deletions cli/command/trust/inspect_pretty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ func (c *fakeClient) Info(context.Context) (system.Info, error) {
return system.Info{}, nil
}

func (c *fakeClient) ImageInspectWithRaw(context.Context, string) (image.InspectResponse, []byte, error) {
return image.InspectResponse{}, []byte{}, nil
func (c *fakeClient) ImageInspect(context.Context, string, ...client.ImageInspectOption) (image.InspectResponse, error) {
return image.InspectResponse{}, nil
}

func (c *fakeClient) ImagePush(context.Context, string, image.PushOptions) (io.ReadCloser, error) {
Expand Down
2 changes: 1 addition & 1 deletion cli/command/trust/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func validateTag(imgRefAndAuth trust.ImageRefAndAuth) error {
}

func checkLocalImageExistence(ctx context.Context, apiClient client.APIClient, imageName string) error {
_, _, err := apiClient.ImageInspectWithRaw(ctx, imageName)
_, err := apiClient.ImageInspect(ctx, imageName)
return err
}

Expand Down
2 changes: 1 addition & 1 deletion cli/compose/convert/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func Services(
ctx context.Context,
namespace Namespace,
config *composetypes.Config,
apiClient client.CommonAPIClient,
apiClient client.APIClient,
) (map[string]swarm.ServiceSpec, error) {
result := make(map[string]swarm.ServiceSpec)
for _, service := range config.Services {
Expand Down
2 changes: 1 addition & 1 deletion vendor.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/distribution/reference v0.6.0
github.com/docker/cli-docs-tool v0.9.0
github.com/docker/distribution v2.8.3+incompatible
github.com/docker/docker v27.0.2-0.20250110234321-69687190936d+incompatible // master (v-next)
github.com/docker/docker v27.0.2-0.20250206180949-6c3797923dcb+incompatible // master (v-next)
github.com/docker/docker-credential-helpers v0.8.2
github.com/docker/go-connections v0.5.0
github.com/docker/go-units v0.5.0
Expand Down
4 changes: 2 additions & 2 deletions vendor.sum
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ github.com/docker/cli-docs-tool v0.9.0/go.mod h1:ClrwlNW+UioiRyH9GiAOe1o3J/TsY3T
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v27.0.2-0.20250110234321-69687190936d+incompatible h1:JqToo31hcYA8YAJwnaF1aq7WUhFRcMNPnkKCUzGFGJM=
github.com/docker/docker v27.0.2-0.20250110234321-69687190936d+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v27.0.2-0.20250206180949-6c3797923dcb+incompatible h1:R6uFQLKwpUW5K3rRtO6PZ5Bhx4CsuiBla2lV+bZQT+Y=
github.com/docker/docker v27.0.2-0.20250206180949-6c3797923dcb+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker-credential-helpers v0.8.2 h1:bX3YxiGzFP5sOXWc3bTPEXdEaZSeVMrFgOr3T+zrFAo=
github.com/docker/docker-credential-helpers v0.8.2/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M=
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0=
Expand Down
Loading

0 comments on commit c962084

Please sign in to comment.