Commit Graph

10114 Commits

Author SHA1 Message Date
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
Sebastiaan van Stijn b00668d4bc
Merge pull request #5497 from austinvazquez/cherry-pick-6075303483f632f301e36c9dab3679949948df52-to-27.x
[27.x backport] docs/reference: stop, restart: add flag descriptions
2024-10-04 12:47:43 +02:00
Sebastiaan van Stijn e978602169
Merge pull request #5498 from austinvazquez/cherry-pick-54a20ce54caa3f24349eebd8f2cf6f47959c5556-to-27.x
[27.x backport] docs: fix a typo in run.md
2024-10-04 12:46:42 +02:00
Sebastiaan van Stijn 19279c9e53
opts: cleanup ParseEnvFile tests
- Use gotest.tools for assertions
- Check for expected error messages
- Don't check for ErrBadKey errors, as it's not used
  as a sentinel error anywhere.
- Use t.SetEnv() instead of depending on `HOME` being set
- Use t.TempDir() for writing temporary files

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b129660dd3)
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2024-10-04 06:11:46 +00:00
David Karlsson d2aec10148
docs: fix a typo in run.md
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
(cherry picked from commit 54a20ce54c)
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2024-10-04 06:07:07 +00:00
Sebastiaan van Stijn 6445ae2f02
docs/reference: stop, restart: add flag descriptions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 6075303483)
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2024-10-04 06:01:26 +00:00
Laura Brehm 5771be8156
Merge pull request #5472 from dvdksn/cp_5471
[27.x backport] fix anchor link to web-based login section
2024-09-23 14:16:53 +01:00
David Karlsson fbd51c01c6 docs: fix anchor link to web-based login section
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
(cherry picked from commit 465e87afc7)
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-09-23 13:53:48 +02:00
David Karlsson 23cea90233 docs: use important callout for buildkit vs legacy builder
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
(cherry picked from commit 8a3d838a19)
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-09-23 13:40:54 +02:00
Laura Brehm ce1223035a
Merge pull request #5462 from thaJeztah/27.x_backport_bump_compose
[27.x] Dockerfile: update compose to v2.29.7
2024-09-20 12:01:47 +01:00
Laura Brehm 263ba959c4
Merge pull request #5461 from laurazard/27.x-backport-update-VERSION 2024-09-20 11:48:12 +01:00
Laura Brehm be9b9f3d70
Update `VERSION` file to `v27.3.1-dev`
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
(cherry picked from commit 91c90a9797)
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2024-09-20 11:41:57 +01:00
Sebastiaan van Stijn a4149b0c3d
Dockerfile: update compose to v2.29.7
Update the compose cli plugin used in the dev-container

full diff: https://github.com/docker/compose/compare/v2.29.4...v2.29.7

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ce26ebc0e9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-09-20 12:41:56 +02:00
Laura Brehm 4aac4154b0
Merge pull request #5458 from thaJeztah/27.x_bump_engine3
[27.x] vendor: github.com/docker/docker v27.3.0
2024-09-20 11:23:44 +01:00
Sebastiaan van Stijn 854695884a
vendor: github.com/docker/docker v27.3.0
no diff, just re-tagged; https://github.com/docker/docker/compare/v27.3.0-rc.2...v27.3.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-09-20 12:13:41 +02:00