Skip to content

Commit b82e19e

Browse files
committed
[28.x] merge v28.3.3 tag into v28.x
The v28.3.3 tag was created from master, but the v28.x branch wasn't fast-forwarded, and PR's merged after that. This should bring the v28.3.3 tag's changes into the v28.x branch. Signed-off-by: Sebastiaan van Stijn <[email protected]>
2 parents eceff3d + 980b856 commit b82e19e

Some content is hidden

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

51 files changed

+260
-505
lines changed

Dockerfile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
11
# syntax=docker/dockerfile:1
22

33
ARG BASE_VARIANT=alpine
4+
5+
# ALPINE_VERSION sets the version of the alpine base image to use, including for the golang image.
6+
# It must be a supported tag in the docker.io/library/alpine image repository
7+
# that's also available as alpine image variant for the Golang version used.
48
ARG ALPINE_VERSION=3.21
59
ARG BASE_DEBIAN_DISTRO=bookworm
610

711
ARG GO_VERSION=1.24.5
812
ARG XX_VERSION=1.6.1
913
ARG GOVERSIONINFO_VERSION=v1.4.1
10-
ARG GOTESTSUM_VERSION=v1.12.0
14+
15+
# GOTESTSUM_VERSION sets the version of gotestsum to install in the dev container.
16+
# It must be a valid tag in the https://github.com/gotestyourself/gotestsum repository.
17+
ARG GOTESTSUM_VERSION=v1.12.3
1118

1219
# BUILDX_VERSION sets the version of buildx to use for the e2e tests.
1320
# It must be a tag in the docker.io/docker/buildx-bin image repository
1421
# on Docker Hub.
15-
ARG BUILDX_VERSION=0.24.0
16-
ARG COMPOSE_VERSION=v2.36.2
22+
ARG BUILDX_VERSION=0.25.0
23+
24+
# COMPOSE_VERSION is the version of compose to install in the dev container.
25+
# It must be a tag in the docker.io/docker/compose-bin image repository
26+
# on Docker Hub.
27+
ARG COMPOSE_VERSION=v2.38.2
1728

1829
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
1930

cli/command/config/formatter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/docker/cli/cli/command/formatter"
99
"github.com/docker/cli/cli/command/inspect"
1010
"github.com/docker/docker/api/types/swarm"
11-
units "github.com/docker/go-units"
11+
"github.com/docker/go-units"
1212
)
1313

1414
const (

cli/command/container/cp.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/docker/cli/cli/command"
1717
"github.com/docker/cli/cli/streams"
1818
"github.com/docker/docker/api/types/container"
19-
units "github.com/docker/go-units"
19+
"github.com/docker/go-units"
2020
"github.com/moby/go-archive"
2121
"github.com/morikuni/aec"
2222
"github.com/pkg/errors"
@@ -398,8 +398,7 @@ func copyToContainer(ctx context.Context, dockerCLI command.Cli, copyConfig cpCo
398398
}
399399

400400
options := container.CopyToContainerOptions{
401-
AllowOverwriteDirWithFile: false,
402-
CopyUIDGID: copyConfig.copyUIDGID,
401+
CopyUIDGID: copyConfig.copyUIDGID,
403402
}
404403

405404
if copyConfig.quiet {

cli/command/container/diff.go

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,17 @@ import (
77
"github.com/docker/cli/cli/command"
88
"github.com/docker/cli/cli/command/completion"
99
"github.com/docker/cli/cli/command/formatter"
10-
"github.com/pkg/errors"
1110
"github.com/spf13/cobra"
1211
)
1312

14-
type diffOptions struct {
15-
container string
16-
}
17-
1813
// NewDiffCommand creates a new cobra.Command for `docker diff`
1914
func NewDiffCommand(dockerCli command.Cli) *cobra.Command {
20-
var opts diffOptions
21-
2215
return &cobra.Command{
2316
Use: "diff CONTAINER",
2417
Short: "Inspect changes to files or directories on a container's filesystem",
2518
Args: cli.ExactArgs(1),
2619
RunE: func(cmd *cobra.Command, args []string) error {
27-
opts.container = args[0]
28-
return runDiff(cmd.Context(), dockerCli, &opts)
20+
return runDiff(cmd.Context(), dockerCli, args[0])
2921
},
3022
Annotations: map[string]string{
3123
"aliases": "docker container diff, docker diff",
@@ -34,16 +26,13 @@ func NewDiffCommand(dockerCli command.Cli) *cobra.Command {
3426
}
3527
}
3628

37-
func runDiff(ctx context.Context, dockerCli command.Cli, opts *diffOptions) error {
38-
if opts.container == "" {
39-
return errors.New("Container name cannot be empty")
40-
}
41-
changes, err := dockerCli.Client().ContainerDiff(ctx, opts.container)
29+
func runDiff(ctx context.Context, dockerCLI command.Cli, containerID string) error {
30+
changes, err := dockerCLI.Client().ContainerDiff(ctx, containerID)
4231
if err != nil {
4332
return err
4433
}
4534
diffCtx := formatter.Context{
46-
Output: dockerCli.Out(),
35+
Output: dockerCLI.Out(),
4736
Format: NewDiffFormat("{{.Type}} {{.Path}}"),
4837
}
4938
return DiffFormatWrite(diffCtx, changes)

cli/command/container/diff_test.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,3 @@ func TestRunDiffClientError(t *testing.T) {
7777
err := cmd.Execute()
7878
assert.ErrorIs(t, err, clientError)
7979
}
80-
81-
func TestRunDiffEmptyContainerError(t *testing.T) {
82-
cli := test.NewFakeCli(&fakeClient{})
83-
84-
cmd := NewDiffCommand(cli)
85-
cmd.SetOut(io.Discard)
86-
cmd.SetErr(io.Discard)
87-
88-
containerID := ""
89-
cmd.SetArgs([]string{containerID})
90-
91-
err := cmd.Execute()
92-
assert.Error(t, err, "Container name cannot be empty")
93-
}

cli/command/container/formatter_stats.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import (
55
"sync"
66

77
"github.com/docker/cli/cli/command/formatter"
8-
"github.com/docker/docker/pkg/stringid"
9-
units "github.com/docker/go-units"
8+
"github.com/docker/go-units"
109
)
1110

1211
const (
@@ -176,7 +175,7 @@ func (c *statsContext) Name() string {
176175

177176
func (c *statsContext) ID() string {
178177
if c.trunc {
179-
return stringid.TruncateID(c.s.ID)
178+
return formatter.TruncateID(c.s.ID)
180179
}
181180
return c.s.ID
182181
}

cli/command/container/formatter_stats_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import (
55
"testing"
66

77
"github.com/docker/cli/cli/command/formatter"
8-
"github.com/docker/docker/pkg/stringid"
8+
"github.com/docker/cli/internal/test"
99
"gotest.tools/v3/assert"
1010
is "gotest.tools/v3/assert/cmp"
1111
)
1212

1313
func TestContainerStatsContext(t *testing.T) {
14-
containerID := stringid.GenerateRandomID()
14+
containerID := test.RandomID()
1515

1616
var ctx statsContext
1717
tt := []struct {

cli/command/container/hijack.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99

1010
"github.com/docker/cli/cli/command"
1111
"github.com/docker/docker/api/types"
12-
"github.com/docker/docker/pkg/ioutils"
1312
"github.com/docker/docker/pkg/stdcopy"
1413
"github.com/moby/term"
1514
"github.com/sirupsen/logrus"
@@ -19,6 +18,18 @@ import (
1918
// TODO: This could be moved to `pkg/term`.
2019
var defaultEscapeKeys = []byte{16, 17}
2120

21+
// readCloserWrapper wraps an io.Reader, and implements an io.ReadCloser
22+
// It calls the given callback function when closed.
23+
type readCloserWrapper struct {
24+
io.Reader
25+
closer func() error
26+
}
27+
28+
// Close calls back the passed closer function
29+
func (r *readCloserWrapper) Close() error {
30+
return r.closer()
31+
}
32+
2233
// A hijackedIOStreamer handles copying input to and output from streams to the
2334
// connection.
2435
type hijackedIOStreamer struct {
@@ -100,7 +111,10 @@ func (h *hijackedIOStreamer) setupInput() (restore func(), err error) {
100111
}
101112
}
102113

103-
h.inputStream = ioutils.NewReadCloserWrapper(term.NewEscapeProxy(h.inputStream, escapeKeys), h.inputStream.Close)
114+
h.inputStream = &readCloserWrapper{
115+
Reader: term.NewEscapeProxy(h.inputStream, escapeKeys),
116+
closer: h.inputStream.Close,
117+
}
104118

105119
return restore, nil
106120
}

cli/command/container/prune.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/docker/cli/cli/command/completion"
1010
"github.com/docker/cli/internal/prompt"
1111
"github.com/docker/cli/opts"
12-
units "github.com/docker/go-units"
12+
"github.com/docker/go-units"
1313
"github.com/pkg/errors"
1414
"github.com/spf13/cobra"
1515
)

cli/command/formatter/buildcache.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"time"
88

99
"github.com/docker/docker/api/types/build"
10-
"github.com/docker/docker/pkg/stringid"
1110
"github.com/docker/go-units"
1211
)
1312

@@ -115,7 +114,7 @@ func (c *buildCacheContext) MarshalJSON() ([]byte, error) {
115114
func (c *buildCacheContext) ID() string {
116115
id := c.v.ID
117116
if c.trunc {
118-
id = stringid.TruncateID(c.v.ID)
117+
id = TruncateID(c.v.ID)
119118
}
120119
if c.v.InUse {
121120
return id + "*"
@@ -131,7 +130,7 @@ func (c *buildCacheContext) Parent() string {
131130
parent = c.v.Parent //nolint:staticcheck // Ignore SA1019: Field was deprecated in API v1.42, but kept for backward compatibility
132131
}
133132
if c.trunc {
134-
return stringid.TruncateID(parent)
133+
return TruncateID(parent)
135134
}
136135
return parent
137136
}

0 commit comments

Comments
 (0)