Commit Graph

10128 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 79113a3db5
Merge pull request #5564 from austinvazquez/cherry-pick-35d7b1a7a6426080f44e044b6564cee990b35eab-to-27.x
[27.x backport] cli/command/container: set empty args in tests and discard output
2024-10-21 23:21:51 +02:00
Sebastiaan van Stijn df7e6e5c5f
cli/command/container: TestWaitExitOrRemoved use subtests
=== RUN   TestWaitExitOrRemoved
    === RUN   TestWaitExitOrRemoved/normal-container
    === RUN   TestWaitExitOrRemoved/give-me-exit-code-42
    === RUN   TestWaitExitOrRemoved/i-want-a-wait-error
    time="2024-10-13T18:48:14+02:00" level=error msg="Error waiting for container: removal failed"
    === RUN   TestWaitExitOrRemoved/non-existent-container-id
    time="2024-10-13T18:48:14+02:00" level=error msg="error waiting for container: no such container: non-existent-container-id"
    --- PASS: TestWaitExitOrRemoved (0.00s)
        --- PASS: TestWaitExitOrRemoved/normal-container (0.00s)
        --- PASS: TestWaitExitOrRemoved/give-me-exit-code-42 (0.00s)
        --- PASS: TestWaitExitOrRemoved/i-want-a-wait-error (0.00s)
        --- PASS: TestWaitExitOrRemoved/non-existent-container-id (0.00s)
    PASS

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 35d7b1a7a6)
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2024-10-21 15:53:20 +00:00
Sebastiaan van Stijn 254b966b0d
cli/command/container: set empty args in tests and discard output
Prevent some tests from failing when running from a pre-compiled
testbinary, and discard output to make the output less noisy.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 3b38dc67be)
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2024-10-21 15:53:09 +00:00
Laura Brehm 220033dd80
Merge pull request #5552 from thaJeztah/27.x_backport_fix_ConfigureAuth_deprecation 2024-10-21 16:42:49 +01:00
Sebastiaan van Stijn dd013610c6
Merge pull request #5563 from vvoland/5554-27.x
[27.x backport] Fix bash completion for `events --filter daemon=`
2024-10-21 11:37:57 +02:00
Harald Albers dc36908ec5
Fix bash completion for `events --filter daemon=`
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit 3f7b156c85)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-10-21 11:12:35 +02:00
Sebastiaan van Stijn a8a8f68268
cli/command: ConfigureAuth: fix deprecation comment
Deprecation comments must have an empty line before them, otherwise tools
and linters may not recognise them. While fixing this, also updated the
reference to PromptUserForCredentials to be a docs-link to make it clickable.

Updates 6e4818e7d6.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 54e3685bcd)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-19 13:10:31 +02:00
Sebastiaan van Stijn 0008d79159
Merge pull request #5543 from thaJeztah/27.x_backport_bump_swarmkit
[27.x backport] vendor: github.com/moby/swarmkit/v2 v2.0.0-20241017191044-e8ecf83ee08e
2024-10-18 11:50:01 +02:00
Sebastiaan van Stijn 16201b3eb2
vendor: github.com/moby/swarmkit/v2 v2.0.0-20241017191044-e8ecf83ee08e
- add Unwrap error to custom error types
- removes dependency on github.com/rexray/gocsi
- fix CSI plugin load issue

full diff: ea1a7cec35...e8ecf83ee0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit cbbb917323)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-18 11:38:19 +02:00
Paweł Gronowski 4241e00d1d
Merge pull request #5540 from thaJeztah/27.x_backport_completion_improvements
[27.x backport] assorted improvements for shell completion
2024-10-18 10:48:48 +02:00
Harald Albers b018e55ca4
Only complete removable containers if --force is not given
Signed-off-by: Harald Albers <github@albersweb.de>
(cherry picked from commit 147630a309)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:43:03 +02:00
Sebastiaan van Stijn e2831282ee
completion: add test for VolumeNames
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e1c472a436)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:43:03 +02:00
Sebastiaan van Stijn b68bf3afe4
completion: add test for NetworkNames
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 302d73f990)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:43:03 +02:00
Sebastiaan van Stijn 77d002ae25
completion: add test for ImageNames
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ab418a38d8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:43:01 +02:00
Sebastiaan van Stijn 95e329d3e3
completion: add test for ContainerNames
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit f3b4094eb0)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:42:10 +02:00
Sebastiaan van Stijn 02da13fb18
completion: add test for NoComplete
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit be197da6b8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:11:05 +02:00
Sebastiaan van Stijn 62230c7ec2
completion: add test for FromList
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 51713196c9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:11:05 +02:00
Sebastiaan van Stijn 954dba4482
completion: add test for FileNames
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a5ca5b33f1)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:11:05 +02:00
Sebastiaan van Stijn 7d1fa132fb
completion: add test for EnvVarNames
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8f2e5662e7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:11:05 +02:00
Sebastiaan van Stijn b6e7eba447
completion: ContainerNames: don't panic on nil filter
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b8cddc63ad)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:11:04 +02:00
Sebastiaan van Stijn 099d4baeed
cli/command/image: add shell completion for --platform flags
With this patch, completion is provided for `--platform` flags:

    docker pull --platform<TAB>
    linux           linux/amd64     linux/arm/v5    linux/arm/v7    linux/arm64/v8  linux/riscv64   wasip1          windows
    linux/386       linux/arm       linux/arm/v6    linux/arm64     linux/ppc64le   linux/s390x     wasip1/wasm     windows/amd64

Note that `docker buildx build` (with BuildKit) does not yet provide completion;
it's provided through buildx, and uses a different format (accepting multiple
comma-separated platforms). Interestingly, tab-completion for `docker build`
currently uses completion for non-buildkit, and has some other issues that may
have to be looked into.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit d42cf96e15)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:10:59 +02:00
Sebastiaan van Stijn dd4b370d3c
cli/command/container: add shell completion for --platform flags
With this patch, completion is provided for `--platform` flags:

    docker run --platform<TAB>
    linux           linux/amd64     linux/arm/v5    linux/arm/v7    linux/arm64/v8  linux/riscv64   wasip1          windows
    linux/386       linux/arm       linux/arm/v6    linux/arm64     linux/ppc64le   linux/s390x     wasip1/wasm     windows/amd64

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8c7f713db6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:10:59 +02:00
Sebastiaan van Stijn 64e98fa375
cli/command/completion: add Platforms
Add a utility for completing platform strings.

Platforms offers completion for platform-strings. It provides a non-exhaustive
list of platforms to be used for completion. Platform-strings are based on
[runtime.GOOS] and [runtime.GOARCH], but with (optional) variants added. A
list of recognised os/arch combinations from the Go runtime can be obtained
through "go tool dist list".

Some noteworthy exclusions from this list:

  - arm64 images ("windows/arm64", "windows/arm64/v8") do not yet exist for windows.
  - we don't (yet) include `os-variant` for completion (as can be used for Windows images)
  - we don't (yet) include platforms for which we don't build binaries, such as
    BSD platforms (freebsd, netbsd, openbsd), android, macOS (darwin).
  - we currently exclude architectures that may have unofficial builds,
    but don't have wide adoption (and no support), such as loong64, mipsXXX,
    ppc64 (non-le) to prevent confusion.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ce1aebcc30)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:10:58 +02:00
Sebastiaan van Stijn e6c6658563
cli/command/container: add unit tests for completion helpers
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit d49e72c0ac)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:08:29 +02:00
Sebastiaan van Stijn 52ac568385
cli/container: use github.com/moby/sys/capability for completions
We used a hard-coded list of capabilities that we copied from containerd,
but the new "capability" package allows use to have a maintained list
of capabilities.

There's likely still some improvements to be made;

First of all, the capability package could provide a function to get the list
of strings.

On the completion-side, we need to consider what format is most convenient;
currently we use the canonical name (uppercase and "CAP_" prefix), however,
tab-completion is case-sensitive by default, so requires the user to type
uppercase letters to filter the list of options.

Bash completion provides a `completion-ignore-case on` option to make completion
case-insensitive (https://askubuntu.com/a/87066), but it looks to be a global
option; the current cobra.CompletionOptions also don't provide this as an option
to be used in the generated completion-script.

Fish completion has `smartcase` (by default?) which matches any case if
all of the input is lowercase.

Zsh does not have a dedicated option, but allows setting matching-rules
(see https://superuser.com/a/1092328).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 462e08219d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-17 23:08:14 +02:00
Sebastiaan van Stijn 9e2d548799
Merge pull request #5530 from thaJeztah/27.x_backport_bump_deps
[27.x backport] vendor assorted dependencies in preparation of engine update
2024-10-14 14:36:53 +02:00
Sebastiaan van Stijn 2668b11ce4
vendor: google.golang.org/grpc v1.66.2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b6d27ff60e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-14 13:31:11 +02:00
Sebastiaan van Stijn 5cbb4ca191
vendor: google.golang.org/protobuf v1.34.1
full diff: https://github.com/protocolbuffers/protobuf-go/compare/v1.33.0...v1.34.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 200225f530)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-14 13:31:11 +02:00
Sebastiaan van Stijn 78be4c464f
vendor: github.com/cespare/xxhash/v2 v2.3.0
full diff: https://github.com/cespare/xxhash/compare/v2.2.0...v2.3.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 9599251d07)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-14 13:31:11 +02:00
Sebastiaan van Stijn c93b0f1a0e
vendor: golang.org/x/net v0.29.0
no changes in vendored code

full diff: https://github.com/golang/net/compare/v0.28.0...v0.29.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ea8aa2a419)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-14 13:31:11 +02:00
Sebastiaan van Stijn 949859a39e
vendor: golang.org/x/crypto v0.27.0
no changes in vendored code

full diff: https://github.com/golang/crypto/compare/v0.26.0...v0.27.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 61867feecf)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-14 13:31:10 +02:00
Sebastiaan van Stijn ae9b655aa8
vendor: golang.org/x/term v0.24.0
full diff: https://github.com/golang/term/compare/v0.23.0...v0.24.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 843ae6d7e2)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-14 13:31:10 +02:00
Sebastiaan van Stijn e93d817980
vendor: golang.org/x/text v0.18.0
no changes in vendored code

full diff: https://github.com/golang/text/compare/v0.17.0...v0.18.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit bea4ee6588)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-14 13:31:10 +02:00
Sebastiaan van Stijn ed7d30ef89
vendor: golang.org/x/sys v0.25.0
full diff: https://github.com/golang/sys/compare/v0.24.0...v0.25.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a88ee33f71)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-14 13:31:10 +02:00
Sebastiaan van Stijn 8437ca4e64
Merge pull request #5531 from thaJeztah/27.x_bump_engine_27.3.1
[27.x] vendor: github.com/docker/docker v27.3.1
2024-10-14 13:29:42 +02:00
Sebastiaan van Stijn 3a1e08d6de
vendor: github.com/docker/docker v27.3.1
no changes in code, as it's the same commit as v27.3.0

full diff: https://github.com/docker/docker/compare/v27.3.0...v27.3.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-12 22:02:17 +02:00
Sebastiaan van Stijn cb3048fbeb
Merge pull request #5519 from thaJeztah/27.x_backport_no_underline
[27.x backport] Do not underline image name
2024-10-08 17:09:05 +02:00
Sebastiaan van Stijn 5721cdc76d
Merge pull request #5518 from thaJeztah/27.x_backport_change_to_inuse
[27.x backport] Images Tree: Change 'Used' to 'In Use'
2024-10-08 17:08:38 +02:00
Sebastiaan van Stijn 5c1cb99051
Merge pull request #5503 from austinvazquez/cherry-pick-9ecfe4f5a7634d9c375ffce1a273c421f2df716c-to-27.x
[27.x backport] move parsing key-value files to a separate package
2024-10-08 16:57:37 +02:00
Nicolas De Loof 9ab3d3a983
move parsing key-value files to a separate package
Move the code for parsing key-value files, such as used for
env-files and label-files to a separate package. This allows
other projects (such as compose) to use the same parsing
logic, but provide custom lookup functions for their situation
(which is slightly different).

The new package provides utilities for parsing key-value files
for either a file or an io.Reader. Most tests for EnvFile were
now testing functionality that's already tested in the new package,
so were (re)moved.

Co-authored-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 9ecfe4f5a7)
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2024-10-08 14:18:58 +00:00
Sebastiaan van Stijn 40539963c2
opts: parseKeyValueFile: cleanup and remove redundant trimming
- the function already trimmed leading whitespace from each line before
  parsing. keys with trailing whitespace would be invalidated, and values
  have whitespace preserved, so there's no need to trim whitespace for the
  key.
- if a line is validated (key is valid), we don't need to reconstruct the
  key=value by concatenating, and we can add the line as-is.
- check if the key is empty before checking if it contains whitespace
- touch-up comments
- rename some variables for readability
- slight cleanup to use early returns / early continues to reduce nesting

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 76196dbb01)
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2024-10-08 14:18:39 +00:00
Sebastiaan van Stijn 25224ab615
opts: remove ErrBadKey as it's not used as a sentinel error
This error was originally introduced `ErrBadEnvVariable` in [moby/moby@500c8ba],
but merely for convenience, and not used as a sentinel error. After the code
was moved from the daemon to the cli repository, it was renamed to be more
generic `ErrBadKey` in commit 2b17f4c8a8.

A search on GitHub shows that there's no consumers using this error as
sentinel error, and it's not used in our own code as such, so it should
be safe to remove this error.

This patch removes the `ErrBadKey` error-type; it also removes the prefix
(`poorly formatted environment:`) to make the error more generic, because
the same function was used both for env-files and label-files.

[moby/moby@500c8ba]: 500c8ba4b6

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 95e221ef4d)
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2024-10-08 14:18:14 +00:00
Djordje Lukic 4694fc8e45
Do not underline image name
Blue text with underline looks too much as a hyperlink I can click on

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
(cherry picked from commit 17040890e4)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-08 16:00:38 +02:00
Brian Goff 352ee0acd4
Images Tree: Change 'Used' to 'In Use'
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit df52ddcfcc)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-08 15:39:06 +02:00
Sebastiaan van Stijn d0cb93ab08
Merge pull request #5512 from austinvazquez/cherry-pick-a6ab65948e6ecaf4167e2ef91b24c30929296256-to-27.x
[27.x backport] ci: update to go1.22.8
2024-10-08 10:38:46 +02:00
Austin Vazquez 132ecbce8b
ci: update to go1.22.8
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
(cherry picked from commit a6ab65948e)
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2024-10-08 03:54:21 +00:00
Sebastiaan van Stijn 011cb195f0
Merge pull request #5509 from austinvazquez/cherry-pick-2f2b16a96687e50682497435a6de3b016ab1a5bc-to-27.x
[27.x backport] docs: fix inaccurate description of --restart=unless-stopped
2024-10-07 19:29:48 +02:00
David Karlsson 6f5bfcb276
docs: fix inaccurate description of --restart=unless-stopped
`unless-stopped` containers are not restart after a daemon restart

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
(cherry picked from commit 2f2b16a966)
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2024-10-07 16:37:35 +00:00
Sebastiaan van Stijn fa0bb9f4b4
Merge pull request #5470 from dvdksn/cp_5469
[27.x backport] use important callout for buildkit vs legacy builder
2024-10-04 13:06:17 +02:00
Sebastiaan van Stijn 4c5eb4c301
Merge pull request #5499 from austinvazquez/cherry-pick-b129660dd39f566c6cdc692467a99bb422001a98-to-27.x
[27.x backport] opts: cleanup ParseEnvFile tests
2024-10-04 13:03:16 +02:00