Commit Graph

10261 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 7908982543
Merge pull request #5467 from Stavrospanakakis/cli-container-tests
command: add tests for container diff and rename
2024-10-04 13:49:32 +02:00
Sebastiaan van Stijn ff3f94a542
Merge pull request #5502 from thaJeztah/separate_kvfile
move parsing key-value files to a separate package
2024-10-04 13:46:08 +02:00
Sebastiaan van Stijn 9025c932b9
Merge pull request #5469 from dvdksn/docs-use-important-callout-legacy-build
docs: use important callout for buildkit vs legacy builder
2024-10-04 13:05:52 +02:00
Nicolas De Loof 9ecfe4f5a7
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>
2024-10-04 12:27:10 +02:00
Sebastiaan van Stijn 9dee12ff69
Merge pull request #5496 from thaJeztah/parseKeyValueFile_refactor
opts: parseKeyValueFile: cleanup and remove redundant trimming
2024-10-04 12:12:09 +02:00
Sebastiaan van Stijn 76196dbb01
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>
2024-10-04 11:56:15 +02:00
Sebastiaan van Stijn dac7319f10
Merge pull request #5495 from thaJeztah/opts_remove_ErrBadKey
opts: remove ErrBadKey as it's not used as a sentinel error
2024-10-03 17:52:56 +02:00
Sebastiaan van Stijn 95e221ef4d
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>
2024-10-03 17:22:22 +02:00
Sebastiaan van Stijn 7c85db6e1a
Merge pull request #5494 from thaJeztah/opts_test_cleanup
opts: cleanup ParseEnvFile tests
2024-10-03 15:36:50 +02:00
Sebastiaan van Stijn b129660dd3
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>
2024-10-03 14:08:22 +02:00
Laura Brehm 30e9abbd3f
Merge pull request #5492 from thaJeztah/completion_unit_tests
cli/command/container: add unit tests for completion helpers
2024-10-02 15:52:14 +01:00
Sebastiaan van Stijn d49e72c0ac
cli/command/container: add unit tests for completion helpers
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-02 10:38:25 +02:00
Sebastiaan van Stijn ccb3b44fe3
Merge pull request #5480 from thaJeztah/moby_sys_capability
cli/container: use github.com/moby/sys/capability for completions
2024-10-01 15:08:46 +02:00
Sebastiaan van Stijn 462e08219d
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>
2024-10-01 14:01:02 +02:00
Sebastiaan van Stijn f4fab2c7f3
Merge pull request #5488 from thaJeztah/align_errs
align "conflicting options" errors for consistency
2024-10-01 13:05:55 +02:00
Sebastiaan van Stijn bd96bdaf1b
align "conflicting options" errors for consistency
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-01 12:08:56 +02:00
Sebastiaan van Stijn 3907414549
Merge pull request #5485 from thaJeztah/time_or_timeout
cli/command/container: stop, restart: rename "--time" to "--timeout"
2024-09-30 13:06:29 +02:00
Sebastiaan van Stijn df8b34595b
cli/command/container: stop, restart: rename "--time" to "--timeout"
This renames the `--time` flag as used on `docker stop` and `docker restart`
to `--timeout`,  bringing it in line with other uses for this property,
such as `--stop-timeout` on `docker run`.

The `--time` option is deprecated and hidden, but will be kept for
backward compatibility, as these options existed for a long time.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-09-30 09:43:54 +02:00
Sebastiaan van Stijn b1ae218f60
Merge pull request #5484 from thaJeztah/stop_restart_flag_descriptions
docs/reference: stop, restart: add flag descriptions
2024-09-27 12:24:24 +02:00
Sebastiaan van Stijn 6075303483
docs/reference: stop, restart: add flag descriptions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-09-27 10:18:55 +02:00
Sebastiaan van Stijn c767b9b2da
Merge pull request #5483 from robmry/ip-range-validation
Check that --ip-range is a CIDR address
2024-09-26 22:49:12 +02:00
Rob Murray 8fca0a1f28 Check that --ip-range is a CIDR address
Signed-off-by: Rob Murray <rob.murray@docker.com>
2024-09-26 20:38:33 +01:00
Sebastiaan van Stijn daabb1533e
Merge pull request #5482 from thaJeztah/restart_stop_unit_tests
cli/command/container: add unit tests for container restart and container stop
2024-09-26 20:06:48 +02:00
Sebastiaan van Stijn ac502b5909
cli/command/container: add unit tests for container stop
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-09-26 18:58:40 +02:00
Sebastiaan van Stijn 16aa994255
cli/command/container: add unit tests for container restart
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-09-26 18:57:27 +02:00
Sebastiaan van Stijn bae4b67c24
Merge pull request #5481 from dvdksn/fix-container-run-typo
docs: fix a typo in run.md
2024-09-26 15:39:20 +02:00
David Karlsson 54a20ce54c docs: fix a typo in run.md
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-09-26 15:33:09 +02:00
Laura Brehm 3a3fe840ed
Merge pull request #5428 from thaJeztah/bump_docker_28
vendor: github.com/docker/docker 164cae56ed95 (master, v-next)
2024-09-24 15:53:30 +01:00
Sebastiaan van Stijn b12ac897fb
vendor: github.com/docker/docker 164cae56ed95 (master, v-next)
full diff: 2269acc7a3...164cae56ed

Co-authored-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-09-24 16:30:30 +02:00
Laura Brehm ff853c42a5
Merge pull request #5454 from thaJeztah/touchup_codeql
gha: codeql: minor touch-ups and fixes
2024-09-24 12:03:11 +01:00
Sebastiaan van Stijn 56d0af783c
Merge pull request #5474 from docker/change_to_inuse
Images Tree: Change 'Used' to 'In Use'
2024-09-24 10:37:17 +02:00
Sebastiaan van Stijn 97a6bf3580
Merge pull request #5473 from rumpl/no-underline
Do not underline image name
2024-09-23 21:02:51 +02:00
Brian Goff df52ddcfcc Images Tree: Change 'Used' to 'In Use'
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2024-09-23 11:26:42 -07:00
Djordje Lukic 17040890e4
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>
2024-09-23 15:36:18 +02:00
Sebastiaan van Stijn 9d478be4a8
Merge pull request #5468 from akerouanton/fix-ps-ipv6
cli/formatter: fix unbracketed IPv6 addrs
2024-09-23 15:31:02 +02:00
Stavros Panakakis 46b360b059 command: add tests for container diff and rename
This commit adds tests for the commands
docker diff and docker rename. Also,
it creates the mock methods of the
docker client ContainerDiff and
ContainerRename so they can
be used in the tests.

For docker diff, it covers the
cases that:
 - the command runs successfully
 - the client returns an error
 - the container id is empty

For docker rename, it covers
the cases that:
 - the command runs successfully
 - the container old name is empty
 - the container new name is empty
 - the client returns an error

Co-authored-by: Laura Brehm <laurabrehm@hey.com>
Signed-off-by: Stavros Panakakis <stavrospanakakis@gmail.com>
2024-09-23 16:17:36 +03:00
Laura Brehm 66977d48e9
Merge pull request #5471 from dvdksn/fix-docker-login-anchorlink
docs: fix anchor link to web-based login section
2024-09-23 14:16:42 +01:00
David Karlsson 465e87afc7 docs: fix anchor link to web-based login section
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-09-23 13:48:33 +02:00
David Karlsson 8a3d838a19 docs: use important callout for buildkit vs legacy builder
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-09-23 13:38:33 +02:00
Albin Kerouanton 3e271461e6 cli/formatter: fix unbracketed IPv6 addrs
Commit 964155cd tried to enclose all IPv6 addresses within brackets but
missed some cases. This commit fixes that, and adds a few test cases.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2024-09-23 12:17:24 +02:00
Laura Brehm baa7a9f7ad
Merge pull request #5460 from laurazard/master-update-VERSION 2024-09-20 11:48:05 +01:00
Laura Brehm 91c90a9797
Update `VERSION` file to `v27.3.1-dev`
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2024-09-20 11:41:30 +01:00
Sebastiaan van Stijn 9b4daca9f2
Merge pull request #5459 from thaJeztah/bump_compose
Dockerfile: update compose to v2.29.7
2024-09-20 12:38:14 +02:00
Sebastiaan van Stijn ce26ebc0e9
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>
2024-09-20 12:22:39 +02:00
Sebastiaan van Stijn 48cfe2137c
Merge pull request #5456 from laurazard/fix-defer-mp-shutdown
telemetry: fix early meterprovider shutdown
2024-09-20 02:41:45 +02:00
Laura Brehm 1355d7e9f8
telemetry: fix early meterprovider shutdown
In 4b5a196fee, we changed the CLI global
meter provider shutdown in order to handle any error returned by the
metric export.

Unfortunately, we dropped a `defer` during the fix, which
causes the meter provider to be immediately shutdown after being created
and metrics to not be collected/exporter.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2024-09-20 01:29:19 +01:00
Sebastiaan van Stijn f468606163
gha: codeql: minor touch-ups and fixes
- remove trailing whitespace
- pin to a versioned ubuntu version
- adjust timeout to be more within expected duration
- remove redundant git checkout, which is no longer needed

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-09-19 11:09:51 +02:00
Sebastiaan van Stijn a5fb752ecf
Merge pull request #5445 from jsternberg/lowercase-windows-drive
command: change drive to lowercase for wsl path
2024-09-18 12:15:45 +02:00
Laura Brehm 4e64c59d64
Merge pull request #5446 from thaJeztah/codeql_updates
gha: update codeql workflow to go1.22.7
2024-09-18 11:04:32 +01:00
Jonathan A. Sternberg 3472bbc28a
command: change drive to lowercase for wsl path
On Windows, the drive casing doesn't matter outside of WSL. For WSL, the
drives are lowercase. When we're producing a WSL path, lowercase the
drive letter.

Co-authored-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
Co-authored-by: Laura Brehm <laurabrehm@hey.com>

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2024-09-18 10:59:08 +01:00