Commit Graph

2278 Commits

Author SHA1 Message Date
Harald Albers 09701feb71 Disable file completion for `--stop-timeout`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 396d9e02cf Disable file completion for `--shm-size`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers ff9c6846b1 Disable file completion for `--security-opt`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers a40ed99d5a Disable file completion for `--runtime`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 39028ced90 Disable file completion for `--publish`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 968d758988 Disable file completion for `--pids-limit`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 5c963884f5 Add completion for `--pid`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 9817e322d9 Disable file completion for `--oom-score-adj`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 39cd60b6eb Disable file completion for `--network-alias`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers b3703fa109 Disable file completion for `--name`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 31f1f43b1b Disable file completion for `--mount`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 0135d7ed2b Disable file completion for `--memory*`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers e27ff3b202 Disable file completion for `--mac-address`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 6a801bcd40 Disable file completion for `--log-*`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 93af729f53 Disable file completion for `--link-local-ip`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 0e4b312b90 Add completion for `--link`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 846439cdc4 Disable file completion for `--label`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 33d870adb7 Disable file completion for `--kernel-memory`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 77fd7d7a16 Disable file completion for `--isolation`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers b9c7f6c67e Add completion for `--ipc`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 784ad51c67 Disable file completion for `--ip6*`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers e08a00701b Disable file completion for `--hostname`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 3ab5af735a Disable file completion for `--health-*`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers d963cfc964 Disable file completion for `--group-add`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers a5aa7c9037 Disable file completion for `--gpus`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 6aba94e6dd Disable file completion for `--expose`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 9906847f54 Disable file completion for `--entrypoint`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 85ab1210ab Disable file completion for `--domainname`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 14038a915d Disable file completion for `--dns*`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 285d0e32be Disable file completion for `--device-*`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 4450f48f07 Disable file completion for `--cpu*`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 00e3b7cdcc Add completion for `--cgroupns`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers fe1db01af1 Disable file completion for `--cgroup-parent`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 75d80775ce Disable file completion for `--blkio-weight*`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 55d4192c3a Add completion for `--attach`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers 98d5b0389d Disable file completion for `--annotation`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers d9766a3c65 Disable file completion for `--add-host`
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Harald Albers cc981e30ba Share the container completions
Signed-off-by: Harald Albers <github@albersweb.de>
2024-10-28 22:48:37 +00:00
Sebastiaan van Stijn 61baf2a3d9
Merge pull request #5570 from thaJeztah/credentials_coverage
cli/config/credentials: add test for save being idempotent
2024-10-22 16:36:58 +02:00
Sebastiaan van Stijn c34b80bc65
Merge pull request #5567 from thaJeztah/config_fix_err
cli/config: improve error when failing to parse config file
2024-10-22 14:05:45 +02:00
Sebastiaan van Stijn 3c78069240
cli/config/credentials: add test for save being idempotent
Test case for d3f6867e4d

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-22 12:22:54 +02:00
Sebastiaan van Stijn 0dd6f7f1b3
cil/config/credentials: remove newStore() test-utility
This function was names slightly confusing, as it returns a fakeStore,
and it didn't do any constructing, so didn't provide value above just
constructing the type.

I'm planning to add more functionality to the fakeStore, but don't want
to maintain a full-fledged constructor for all of that, so let's remove
this utility.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-22 10:58:29 +02:00
Sebastiaan van Stijn 5f4b14950e
cli: remove deprecated Errors type
The Errors type was deprecated in d3bafa5f3e,
which has been included in the 27.4.0 release.

This patch removes the type, as there are no external consumers.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-22 10:43:24 +02:00
Sebastiaan van Stijn 1aab64dd90
Merge pull request #5547 from thaJeztah/plugin_better_error
cli/command/plugins: use errors.Join instead of custom cli.Errors, and deprecate cli.Errors
2024-10-22 10:42:26 +02:00
Sebastiaan van Stijn 0ab0eca8bd
Merge pull request #5550 from thaJeztah/login_minor_refactor
cli/command: PromptUserForCredentials: assorted minor improvements and (linting) fixes
2024-10-21 23:23:06 +02:00
Sebastiaan van Stijn d96f8b7f91
cli/config: improve error when failing to parse config file
The format had a stray colon and space included. While fixing that, also
updating the error message to clarify the error happened while parsing
the file (not so much "loading" it).

Before:

    WARNING: Error loading config file: /root/.docker/config.json: : json: cannot unmarshal bool into Go struct field ConfigFile.features of type string

After:

    WARNING: Error parsing config file (/root/.docker/config.json): json: cannot unmarshal bool into Go struct field ConfigFile.features of type string

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-21 18:26:02 +02:00
Sebastiaan van Stijn abb8e9b78a
Merge pull request #5546 from thaJeztah/hints_coverage
cli/hints: add tests
2024-10-21 18:08:28 +02:00
Laura Brehm 7029147458
Merge pull request #5557 from thaJeztah/minor_linting_issues 2024-10-21 17:00:40 +01:00
Paweł Gronowski d2b87a0a3b
Merge pull request #5553 from thaJeztah/login_idempotent
cli/config/credentials: skip saving config-file if credentials didn't change
2024-10-21 15:23:26 +02:00
Sebastiaan van Stijn d3f6867e4d
cli/config/credentials: skip saving config-file if credentials didn't change
Before this change, the config-file was always updated, even if there
were no changes to save. This could cause issues when the config-file
already had credentials set and was read-only for the current user.

For example, on NixOS, this poses a problem because `config.json` is a
symlink to a write-protected file;

    $ readlink ~/.docker/config.json
    /home/username/.config/sops-nix/secrets/ghcr_auth

    $ readlink -f ~/.docker/config.json
    /run/user/1000/secrets.d/28/ghcr_auth

Which causes `docker login` to fail, even if no changes were to be made;

    Error saving credentials: rename /home/derek/.docker/config.json2180380217 /home/username/.config/sops-nix/secrets/ghcr_auth: invalid cross-device link

This patch updates the code to only update the config file if changes
were detected. It there's nothing to save, it skips updating the file,
as well as skips printing the warning about credentials being stored
insecurely.

With this patch applied:

    $ docker login -u yourname
    Password:

    WARNING! Your credentials are stored unencrypted in '/root/.docker/config.json'.
    Configure a credential helper to remove this warning. See
    https://docs.docker.com/go/credential-store/

    Login Succeeded

    $ docker login -u yourname
    Password:
    Login Succeeded

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-10-21 00:19:52 +02:00