Commit Graph

2411 Commits

Author SHA1 Message Date
d8e76bc33f cli: define const for magic value
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 15:24:52 +01:00
9fda9134a9 cli/command/service/progress: define const for magic value
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 15:24:52 +01:00
3825d37923 cli/command: define some consts for repeated values
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 15:24:44 +01:00
2f65cf7d1a cli/command: fix some unused-receiver linting
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-17 14:53:51 +01:00
88a019a9bb Merge pull request #5833 from vvoland/subpath-swarm-fix
Some checks failed
build / plugins (push) Has been cancelled
codeql / codeql (push) Has been cancelled
e2e / e2e (alpine, 23, connhelper-ssh) (push) Has been cancelled
e2e / e2e (alpine, 23, experimental) (push) Has been cancelled
e2e / e2e (alpine, 23, non-experimental) (push) Has been cancelled
e2e / e2e (alpine, 26.1, connhelper-ssh) (push) Has been cancelled
e2e / e2e (alpine, 26.1, experimental) (push) Has been cancelled
e2e / e2e (alpine, 26.1, non-experimental) (push) Has been cancelled
e2e / e2e (alpine, 27, connhelper-ssh) (push) Has been cancelled
e2e / e2e (alpine, 27, experimental) (push) Has been cancelled
e2e / e2e (alpine, 27, non-experimental) (push) Has been cancelled
e2e / e2e (debian, 23, connhelper-ssh) (push) Has been cancelled
e2e / e2e (debian, 23, experimental) (push) Has been cancelled
e2e / e2e (debian, 23, non-experimental) (push) Has been cancelled
e2e / e2e (debian, 26.1, connhelper-ssh) (push) Has been cancelled
e2e / e2e (debian, 26.1, experimental) (push) Has been cancelled
e2e / e2e (debian, 26.1, non-experimental) (push) Has been cancelled
e2e / e2e (debian, 27, connhelper-ssh) (push) Has been cancelled
e2e / e2e (debian, 27, experimental) (push) Has been cancelled
e2e / e2e (debian, 27, non-experimental) (push) Has been cancelled
test / ctn (push) Has been cancelled
test / host (macos-13) (push) Has been cancelled
test / host (macos-14) (push) Has been cancelled
validate / validate (lint) (push) Has been cancelled
validate / validate (shellcheck) (push) Has been cancelled
validate / validate (update-authors) (push) Has been cancelled
validate / validate (validate-vendor) (push) Has been cancelled
validate / validate-md (push) Has been cancelled
validate / validate-make (manpages) (push) Has been cancelled
validate / validate-make (yamldocs) (push) Has been cancelled
cli/compose: Handle Volume Subpath
2025-02-17 12:54:24 +01:00
add32e4b51 cli/compose: Handle Volume Subpath
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-17 12:39:23 +01:00
4cc2dce807 cli/compose: Fix Image Subpath
handleImageToMount was an exact copy of handleBindToMount instead of
populating the ImageOptions.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-17 12:37:24 +01:00
e868f0f580 cli/command/container/opts_test: Fix entrypoint parsing logic
Right now the test passes even if you change the expected value.
It passes if the array has 1 element.

Signed-off-by: Lajos Papp <lalyos@yahoo.com>
2025-02-17 11:10:50 +00:00
1d3eb6f95b vendor: github.com/docker/docker 5cc3f1dab895 (master, v28.0.0-rc.2)
full diff: b570831cc3...5cc3f1dab8

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-14 19:22:53 +01:00
c9e7daec81 Merge pull request #5755 from LaurentGoderre/image-mount-subpath
Add image mount options
2025-02-13 13:09:12 +00:00
0eda4c51d7 Merge pull request #5818 from mohammedfuta2000/5814-limit-completion
Restrict completion to one suggestion on run, history, push, tag
2025-02-13 13:54:08 +01:00
a656dfd409 Restrict completion for some commands with a limit paramter for ImageNames
Previously, multiple suggestions were provided when completing
commands like `run`, `history` and `push`. This change
limits completion to a single suggestion for the above and 2 suggestions for `tag`

Signed-off-by: Mohammed Aminu Futa <mohammedfuta2000@gmail.com>
2025-02-12 12:42:19 +00:00
04b1b4e08a Add image mount options
Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
2025-02-11 12:19:12 -05:00
c6a7f9a646 vendor: github.com/docker/docker b570831cc3a3 (master, v28.0.0-rc.2)
full diff: https://github.com/docker/docker/compare/v28.0.0-rc.1...b570831cc3a3fcfe4edc96af4c249199b019c7dd

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-11 18:06:55 +01:00
558ebd5922 vendor: github.com/spf13/pflag v1.0.6, remove local IPNetSliceVar fork
- Add exported functions to preserve pkg/flag compatibility
- Add IPNetSlice and unit tests
- Revert the local fork added in 80a2256478,
  which was pending the upstream feature to be shipped in a release.

full diff: https://github.com/spf13/pflag/compare/v1.0.5...v1.0.6

Revert "Swarm init: use local IPNetSliceValue"

This reverts commit 80a2256478.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-11 12:19:51 +01:00
2c17edf804 cli/connhelper/commandcon.New: pass context with WithoutCancel
Passing the context to the constructor, but explicitly making it
non-cancelable and add a comment describing why context-cancelation
should not be propagated.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-10 21:41:48 +01:00
61a3b4bd50 Remove preceding white space from cobra help template
Signed-off-by: thelovekesh <lovekesh.kumar@rtcamp.com>
Signed-off-by: Lovekesh Kumar <lovekesh.kumar@rtcamp.com>
2025-02-10 10:51:25 +01:00
01da8a582f vendor: github.com/docker/docker 6c3797923dcb (master, v28.0-dev)
full diff: 6968719093...6c3797923d

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-06 19:16:50 +01:00
85a77af591 Don't print "context canceled" if user terminated
Without breaking API compatibility, this patch allows us to know whether
a returned `cli/StatusError` was caused by a context cancellation or
not, which we can use to provide a nicer UX and not print the Go
"context canceled" error message if this is the cause.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2025-02-06 14:16:20 +01:00
eb6546b523 Merge pull request #5774 from Benehiko/improve-login-text
login: improve text on already authenticated and on OAuth login
2025-02-05 12:06:53 +00:00
6d7afd48a4 login: improve text on already authenticated and on OAuth login
Users have trouble understanding the different login paths on the CLI.
The default login is performed through an OAuth flow with the option to
fallback to a username and PAT login using the docker login -u <username>
option.

This patch improves the text around docker login, indicating:
- The username is shown when already authenticated
- Steps the user can take to switch user accounts are printed when
  authenticated in an info.
- When not authenticated, the OAuth login flow explains the fallback
  clearly to the user in an info.
- The password prompt now explicitly states that it accepts a PAT in an
  info.

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
2025-02-05 12:32:24 +01:00
dff0dc8afa Merge pull request #5790 from thaJeztah/leftover_cleanups
cli/command: some minor cleanups
2025-02-04 12:30:30 +00:00
7c3fa8172b Merge pull request #5791 from thaJeztah/multi_errors
cli/command: use errors.Join instead of our own implementation
2025-02-04 12:23:11 +01:00
5b90e0e4e5 Merge pull request #5744 from vvoland/image-tree-chips
image/tree: Chips to represent "in use"
2025-02-04 09:23:24 +00:00
81da375c4d cli/command/service: runScale: use errors.Join, and cleanup
- Use stdlib multi-errors instead of creating our own
- use apiClient instead of client for the API client to
  prevent shadowing imports.
- use dockerCLI with Go's standard camelCase casing.
- rewrite runServiceScale to return warnings, instead of printing them

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 20:35:48 +01:00
09b513ecfd cli/command/service: runRollback: remove intermediate vars
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 20:31:52 +01:00
aa96cb7aa0 cli/command/volume: use errors.Join
Use stdlib multi-errors instead of creating our own

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 20:31:52 +01:00
be985bd28e cli/command/stack/swarm: use errors.Join
Use stdlib multi-errors instead of creating our own

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 20:31:45 +01:00
f1193effc0 cli/command/service: use errors.Join
Use stdlib multi-errors instead of creating our own

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 19:36:59 +01:00
f9e4335564 cli/command/secret: use errors.Join
- Use stdlib multi-errors instead of creating our own
- use apiClient instead of client for the API client to
  prevent shadowing imports.
- use dockerCLI with Go's standard camelCase casing.
- rename runSecretRemove to runRemove to align with other commands

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 19:33:58 +01:00
2a9fd4a939 cli/command/node: use errors.Join
Use stdlib multi-errors instead of creating our own

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 19:30:56 +01:00
f8729c6da2 cli/command/manifest: use errors.Join
Use stdlib multi-errors instead of creating our own

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 19:30:25 +01:00
1fd9d0dd34 cli/command/manifest: pass manifest-store and handle context
- pass through the manifest-store, instead of the CLI as a whole
- handle context cancellation
- rename `runRm` to `runRemove` to align with other commands

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 19:27:59 +01:00
f431f61568 cli/command/inspect: use errors.Join
Use stdlib multi-errors instead of creating our own

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 19:21:27 +01:00
7147e85f63 cli/command/image: use errors.Join
Use stdlib multi-errors instead of creating our own

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 19:20:34 +01:00
2b9a4d5f4c cli/command/context: use errors.Join
Use stdlib multi-errors instead of creating our own; also
touch-up one error and some minor cleanups.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 19:19:18 +01:00
150f27b68c cli/command/container: use errors.Join
Use stdlib multi-errors instead of creating our own

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 19:17:50 +01:00
791e06b435 cli/command/config: RunConfigRemove: use errors.Join
Use stdlib multi-errors instead of creating our own

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 19:16:28 +01:00
632f179e8f cli/command/image: minor cleanups
- use apiClient instead of client for the API client to
  prevent shadowing imports.
- use dockerCLI with Go's standard camelCase casing.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 19:08:08 +01:00
e81d76ffe1 cli/command/container: minor cleanups
- use apiClient instead of client for the API client to
  prevent shadowing imports.
- use dockerCLI with Go's standard camelCase casing.
- suppress some errors to make my IDE and linters happier

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 19:08:08 +01:00
deaa601189 cli/command/config: minor cleanups
- use apiClient instead of client for the API client to
  prevent shadowing imports.
- use dockerCLI with Go's standard camelCase casing.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 19:08:08 +01:00
ce30966636 Merge pull request #5785 from thaJeztah/checkpoint_test_keeprunning
TestCheckpointCreateWithOptions check both "keep-running=true/false"
2025-02-03 18:25:31 +01:00
795b7d5f0a Merge pull request #5788 from thaJeztah/progress_clean
service/progress: ServiceProgress: avoid fuzzy matching service ID in loop
2025-02-03 18:24:52 +01:00
c950d48f72 image/tree: Chips to represent "in use"
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-02-03 18:24:32 +01:00
919bd6aff3 Merge pull request #5779 from thaJeztah/fix_plugin_multierr
cli/command/plugins: runRemove: fix incorrect use of errors.Join
2025-02-03 18:24:27 +01:00
8169a5142b jsonstream: Display: rename var that shadowed type
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 16:17:11 +01:00
a4288003bd service/progress: ServiceProgress: avoid fuzzy matching service ID in loop
Tasks with a service filter will result in the daemon performing a lookup
of the full service ID, then updating the provided filter with the actual
ID: 96ded2a1ba/daemon/cluster/tasks.go (L15-L30)

The `getService()` helper has a fast-path for situations where the given
filter is a full ID, before falling back to fuzzy-logic to search filters
by service name or prefix, which would return an error if the result is
ambiguous;
96ded2a1ba/daemon/cluster/helpers.go (L62-L81)

The loop executed here calls `client.ServiceInspectWithRaw()` to get info
of the service, and that method is ultimately calling the exact same
`getService()` helper on the daemon side, which means that we don't need
to repeat the work; we can use the `Service.ID` resolved from that call,
and use it to apply as filter for listing the tasks.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 16:16:19 +01:00
e88b1939f7 service/progress: newReplicatedJobProgressUpdater: slight cleanup
Use intermediate vars, so that the replicatedJobProgressUpdater can
be created in one go intead of setting some fields after the fact.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 16:16:16 +01:00
dea59eabba cli/command/stack/swarm: waitOnServices remove redundant check for multi-error
This check was redundant, because `errors.Join` already checks if the
list of errors is either empty, or only contains `nil` errors, as can
be seen in [this example][1];

    package main

    import (
        "errors"
        "testing"
    )

    func TestMultiErr(t *testing.T) {
        var errs []error
        if err := errors.Join(errs...); err != nil {
            t.Fatal(err)
        }

        errs = append(errs, nil, nil, nil)
        t.Logf("errs contains %d elements", len(errs))
        if err := errors.Join(errs...); err != nil {
            t.Fatal(err)
        }

        errs = append(errs, errors.New("with an error"))
        if err := errors.Join(errs...); err == nil {
            t.Fatal("expected an error")
        }
    }

[1]: https://go.dev/play/p/iSuGP81eght

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 13:26:43 +01:00
37b25f2265 cli/command/plugins: runRemove: fix incorrect use of errors.Join
commit 71ebbb81ae replaced the use of the
custom "cli.Errors" type for stdlib's errors.Join, however it made a
mistake by calling errors.Join for each error occurred, which "nests"
each error instead of putting each error at the same level.

Thanks to Paweł Gronowski for spotting this on the [pull request][1]

[1]: 71ebbb81ae (r1810257735)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-02-03 13:08:05 +01:00