Skip to content

Commit 790983c

Browse files
authored
Merge branch 'docker:master' into allow-credential-full-path
2 parents e5ff2f8 + 747cb44 commit 790983c

File tree

488 files changed

+15208
-4886
lines changed

Some content is hidden

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

488 files changed

+15208
-4886
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ jobs:
121121
type=semver,pattern={{version}}
122122
type=ref,event=branch
123123
type=ref,event=pr
124-
type=sha
125124
-
126125
name: Build and push image
127126
uses: docker/bake-action@v6

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
name: Update Go
6464
uses: actions/setup-go@v5
6565
with:
66-
go-version: "1.24.3"
66+
go-version: "1.24.4"
6767
-
6868
name: Initialize CodeQL
6969
uses: github/codeql-action/init@v3

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
name: Set up Go
6767
uses: actions/setup-go@v5
6868
with:
69-
go-version: "1.24.3"
69+
go-version: "1.24.4"
7070
-
7171
name: Test
7272
run: |

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ run:
55
# which causes it to fallback to go1.17 semantics.
66
#
77
# TODO(thaJeztah): update "usetesting" settings to enable go1.24 features once our minimum version is go1.24
8-
go: "1.24.3"
8+
go: "1.24.4"
99

1010
timeout: 5m
1111

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ ARG BASE_VARIANT=alpine
44
ARG ALPINE_VERSION=3.21
55
ARG BASE_DEBIAN_DISTRO=bookworm
66

7-
ARG GO_VERSION=1.24.3
7+
ARG GO_VERSION=1.24.4
88
ARG XX_VERSION=1.6.1
99
ARG GOVERSIONINFO_VERSION=v1.4.1
1010
ARG GOTESTSUM_VERSION=v1.12.0
1111

1212
# BUILDX_VERSION sets the version of buildx to use for the e2e tests.
1313
# It must be a tag in the docker.io/docker/buildx-bin image repository
1414
# on Docker Hub.
15-
ARG BUILDX_VERSION=0.23.0
16-
ARG COMPOSE_VERSION=v2.35.1
15+
ARG BUILDX_VERSION=0.24.0
16+
ARG COMPOSE_VERSION=v2.36.2
1717

1818
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
1919

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
28.2.0-dev
1+
28.3.0-dev

cli/command/container/exec.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func RunExec(ctx context.Context, dockerCLI command.Cli, containerIDorName strin
9999
if _, err := apiClient.ContainerInspect(ctx, containerIDorName); err != nil {
100100
return err
101101
}
102-
if !execOptions.Detach {
102+
if !options.Detach {
103103
if err := dockerCLI.In().CheckTty(execOptions.AttachStdin, execOptions.Tty); err != nil {
104104
return err
105105
}
@@ -117,9 +117,9 @@ func RunExec(ctx context.Context, dockerCLI command.Cli, containerIDorName strin
117117
return errors.New("exec ID empty")
118118
}
119119

120-
if execOptions.Detach {
120+
if options.Detach {
121121
return apiClient.ContainerExecStart(ctx, execID, container.ExecStartOptions{
122-
Detach: execOptions.Detach,
122+
Detach: options.Detach,
123123
Tty: execOptions.Tty,
124124
ConsoleSize: execOptions.ConsoleSize,
125125
})
@@ -223,7 +223,6 @@ func parseExec(execOpts ExecOptions, configFile *configfile.ConfigFile) (*contai
223223
Privileged: execOpts.Privileged,
224224
Tty: execOpts.TTY,
225225
Cmd: execOpts.Command,
226-
Detach: execOpts.Detach,
227226
WorkingDir: execOpts.Workdir,
228227
}
229228

cli/command/container/exec_test.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"errors"
66
"io"
77
"os"
8+
"strconv"
89
"testing"
910

1011
"github.com/docker/cli/cli"
@@ -75,8 +76,7 @@ TWO=2
7576
{
7677
options: withDefaultOpts(ExecOptions{Detach: true}),
7778
expected: container.ExecOptions{
78-
Detach: true,
79-
Cmd: []string{"command"},
79+
Cmd: []string{"command"},
8080
},
8181
},
8282
{
@@ -86,9 +86,8 @@ TWO=2
8686
Detach: true,
8787
}),
8888
expected: container.ExecOptions{
89-
Detach: true,
90-
Tty: true,
91-
Cmd: []string{"command"},
89+
Tty: true,
90+
Cmd: []string{"command"},
9291
},
9392
},
9493
{
@@ -97,7 +96,6 @@ TWO=2
9796
expected: container.ExecOptions{
9897
Cmd: []string{"command"},
9998
DetachKeys: "de",
100-
Detach: true,
10199
},
102100
},
103101
{
@@ -109,7 +107,6 @@ TWO=2
109107
expected: container.ExecOptions{
110108
Cmd: []string{"command"},
111109
DetachKeys: "ab",
112-
Detach: true,
113110
},
114111
},
115112
{
@@ -141,10 +138,12 @@ TWO=2
141138
},
142139
}
143140

144-
for _, testcase := range testcases {
145-
execConfig, err := parseExec(testcase.options, &testcase.configFile)
146-
assert.NilError(t, err)
147-
assert.Check(t, is.DeepEqual(testcase.expected, *execConfig))
141+
for i, testcase := range testcases {
142+
t.Run("test "+strconv.Itoa(i+1), func(t *testing.T) {
143+
execConfig, err := parseExec(testcase.options, &testcase.configFile)
144+
assert.NilError(t, err)
145+
assert.Check(t, is.DeepEqual(testcase.expected, *execConfig))
146+
})
148147
}
149148
}
150149

cli/command/container/utils.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ func legacyWaitExitOrRemoved(ctx context.Context, apiClient client.APIClient, co
7575

7676
eventProcessor := func(e events.Message) bool {
7777
stopProcessing := false
78-
switch e.Status {
79-
case "die":
78+
switch e.Action { //nolint:exhaustive // TODO(thaJeztah): make exhaustive
79+
case events.ActionDie:
8080
if v, ok := e.Actor.Attributes["exitCode"]; ok {
8181
code, cerr := strconv.Atoi(v)
8282
if cerr != nil {
@@ -98,10 +98,10 @@ func legacyWaitExitOrRemoved(ctx context.Context, apiClient client.APIClient, co
9898
}
9999
}()
100100
}
101-
case "detach":
101+
case events.ActionDetach:
102102
exitCode = 0
103103
stopProcessing = true
104-
case "destroy":
104+
case events.ActionDestroy:
105105
stopProcessing = true
106106
}
107107
return stopProcessing

cli/command/image/remove.go

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77

88
cerrdefs "github.com/containerd/errdefs"
9+
"github.com/containerd/platforms"
910
"github.com/docker/cli/cli"
1011
"github.com/docker/cli/cli/command"
1112
"github.com/docker/cli/cli/command/completion"
@@ -14,32 +15,38 @@ import (
1415
)
1516

1617
type removeOptions struct {
17-
force bool
18-
noPrune bool
18+
force bool
19+
noPrune bool
20+
platforms []string
1921
}
2022

2123
// NewRemoveCommand creates a new `docker remove` command
22-
func NewRemoveCommand(dockerCli command.Cli) *cobra.Command {
23-
var opts removeOptions
24+
func NewRemoveCommand(dockerCLI command.Cli) *cobra.Command {
25+
var options removeOptions
2426

2527
cmd := &cobra.Command{
2628
Use: "rmi [OPTIONS] IMAGE [IMAGE...]",
2729
Short: "Remove one or more images",
2830
Args: cli.RequiresMinArgs(1),
2931
RunE: func(cmd *cobra.Command, args []string) error {
30-
return runRemove(cmd.Context(), dockerCli, opts, args)
32+
return runRemove(cmd.Context(), dockerCLI, options, args)
3133
},
32-
ValidArgsFunction: completion.ImageNames(dockerCli, -1),
34+
ValidArgsFunction: completion.ImageNames(dockerCLI, -1),
3335
Annotations: map[string]string{
3436
"aliases": "docker image rm, docker image remove, docker rmi",
3537
},
3638
}
3739

3840
flags := cmd.Flags()
3941

40-
flags.BoolVarP(&opts.force, "force", "f", false, "Force removal of the image")
41-
flags.BoolVar(&opts.noPrune, "no-prune", false, "Do not delete untagged parents")
42+
flags.BoolVarP(&options.force, "force", "f", false, "Force removal of the image")
43+
flags.BoolVar(&options.noPrune, "no-prune", false, "Do not delete untagged parents")
4244

45+
// TODO(thaJeztah): create a "platforms" option for this (including validation / parsing).
46+
flags.StringSliceVar(&options.platforms, "platform", nil, `Remove only the given platform variant. Formatted as "os[/arch[/variant]]" (e.g., "linux/amd64")`)
47+
_ = flags.SetAnnotation("platform", "version", []string{"1.50"})
48+
49+
_ = cmd.RegisterFlagCompletionFunc("platform", completion.Platforms)
4350
return cmd
4451
}
4552

@@ -58,6 +65,14 @@ func runRemove(ctx context.Context, dockerCLI command.Cli, opts removeOptions, i
5865
PruneChildren: !opts.noPrune,
5966
}
6067

68+
for _, v := range opts.platforms {
69+
p, err := platforms.Parse(v)
70+
if err != nil {
71+
return err
72+
}
73+
options.Platforms = append(options.Platforms, p)
74+
}
75+
6176
// TODO(thaJeztah): this logic can likely be simplified: do we want to print "not found" errors at all when using "force"?
6277
fatalErr := false
6378
var errs []error

cli/command/image/tree.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,16 @@ func getPossibleChips(view treeView) (chips []imageChip) {
170170

171171
var possible []imageChip
172172
for _, img := range view.images {
173+
details := []imageDetails{img.Details}
174+
173175
for _, c := range img.Children {
176+
details = append(details, c.Details)
177+
}
178+
179+
for _, d := range details {
174180
for idx := len(remaining) - 1; idx >= 0; idx-- {
175181
chip := remaining[idx]
176-
if chip.check(&c.Details) {
182+
if chip.check(&d) {
177183
possible = append(possible, chip)
178184
remaining = append(remaining[:idx], remaining[idx+1:]...)
179185
}

cli/command/registry.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInf
4343
_, _ = fmt.Fprintf(cli.Out(), "\nLogin prior to %s:\n", cmdName)
4444
authConfig, err := GetDefaultAuthConfig(cli.ConfigFile(), true, configKey, isDefaultRegistry)
4545
if err != nil {
46-
_, _ = fmt.Fprintf(cli.Err(), "Unable to retrieve stored credentials for %s, error: %s.\n", authConfigKey, err)
46+
_, _ = fmt.Fprintf(cli.Err(), "Unable to retrieve stored credentials for %s, error: %s.\n", configKey, err)
4747
}
4848

4949
select {
@@ -52,7 +52,7 @@ func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInf
5252
default:
5353
}
5454

55-
authConfig, err = PromptUserForCredentials(ctx, cli, "", "", authConfig.Username, authConfigKey)
55+
authConfig, err = PromptUserForCredentials(ctx, cli, "", "", authConfig.Username, configKey)
5656
if err != nil {
5757
return "", err
5858
}

0 commit comments

Comments
 (0)