Commit Graph

8346 Commits

Author SHA1 Message Date
Sebastiaan van Stijn ee599f6422
Merge pull request #3891 from thaJeztah/update_engine
vendor: docker/docker v20.10.3-0.20221201081640-bb2eab21c6db (v23.0.0-dev)
2022-12-01 12:59:43 +01:00
Sebastiaan van Stijn 4bee65ffaa
Merge pull request #3890 from thaJeztah/authors_update
Update mailmap and AUTHORS
2022-12-01 12:59:26 +01:00
Sebastiaan van Stijn 1768240bcd
cli/command/container: runPort: sort ports before printing
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-01 10:58:40 +01:00
Sebastiaan van Stijn c5613ac032
cli/command/container: TestNewPortCommandOutput improve test
Make sure that the container has multiple port-mappings to illustrate
that only the given port is matched.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-01 10:52:15 +01:00
Sebastiaan van Stijn 58487e088a
cli/command/container: runPort(): slight refactor
- use strings.Cut
- don't use nat.NewPort as we don't accept port ranges
- use an early return if there's no results

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-01 10:39:34 +01:00
Sebastiaan van Stijn f0435fd3f3
cli/command/container: runPort(): update godoc, and add todo
We should consider showing all mappings for a given port if no specific
proto was specified.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-01 10:20:57 +01:00
Sebastiaan van Stijn f2566760a8
Update AUTHORS header to indicate it's generated
Using both @generated, and using Go's format for generated files,
to match the format we now use on moby/moby.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-01 10:05:22 +01:00
Sebastiaan van Stijn b81acd7c4e
Update mailmap and AUTHORS
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-01 10:04:48 +01:00
Sebastiaan van Stijn 25c06c755c
vendor: docker/docker v20.10.3-0.20221201081640-bb2eab21c6db (v23.0.0-dev)
full diff: a913b5ad7e...bb2eab21c6

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-01 09:48:58 +01:00
Sebastiaan van Stijn ab794859fe
Merge pull request #3847 from thaJeztah/context_lazy_evaluate
context: implement lazy loading, and other improvements
2022-11-29 00:22:02 +01:00
Sebastiaan van Stijn 2c9dff1436
cli/command/context: context ls: always show current context
if a context is set (e.g. through DOCKER_CONTEXT or the CLI config file), but
wasn't found, then a "stub" context is added, including an error message that
the context doesn't exist.

    DOCKER_CONTEXT=nosuchcontext docker context ls
    NAME              DESCRIPTION                               DOCKER ENDPOINT               ERROR
    default           Current DOCKER_HOST based configuration   unix:///var/run/docker.sock
    nosuchcontext *                                                                           context "nosuchcontext": context not found: …

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-28 23:41:29 +01:00
Sebastiaan van Stijn ed4b0a67be
cli/command/context: context ls: add ERROR column, and don't fail early
This updates `docker context ls` to:

- not abort listing contexts when failing one (or more) contexts
- instead, adding an ERROR column to inform the user there was
  an issue loading the context.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-28 16:52:02 +01:00
Sebastiaan van Stijn 14f97cc10a
cli/command: DockerCli.ServerInfo() load info lazily
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-28 16:52:02 +01:00
Sebastiaan van Stijn 3b7235edca
cli/command: initialize client and load content lazily
This allows commands that don't require a client connection (such as `context use`)
to be functional, but still produces an error when trying to run a command that
needs to connect with the API;

    mkdir -p ~/.docker/ && echo '{"currentContext":"nosuchcontext"}' >  ~/.docker/config.json
    docker version
    Failed to initialize: unable to resolve docker endpoint: load context "nosuchcontext": context does not exist: open /root/.docker/contexts/meta/8bfef2a74c7d06add4bf4c73b0af97d9f79c76fe151ae0e18b9d7e57104c149b/meta.json: no such file or directory

    docker context use default
    default
    Current context is now "default"

    docker version
    Client:
     Version:           22.06.0-dev
     API version:       1.42
     ...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-28 16:52:02 +01:00
Sebastiaan van Stijn 2c41bbc49f
cli/command/task: taskContext.Error(): use ellipsis utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-28 16:29:04 +01:00
Sebastiaan van Stijn 0ed80a3a58
cli/command/formatter: NewClientContextFormat(): unconvert
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-28 16:28:47 +01:00
Sebastiaan van Stijn 30a0d0c6d6
cli/command/formatter: define const for error column-headers
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-28 16:28:06 +01:00
Sebastiaan van Stijn 8b1cbfd769
Merge pull request #3887 from thaJeztah/context_lazy_evaluate_step4
context: minor refactoring and fixes
2022-11-28 16:08:07 +01:00
Sebastiaan van Stijn 60987b8d7a
cli/command: DockerCli: keep reference to options for later use
Store a reference to the options in the client, so that they are available
for later use.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-28 15:14:36 +01:00
Sebastiaan van Stijn 181769f18c
cli/command: remove DockerCli.loadConfigFile()
This makes it more transparent what's happening.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-28 13:24:07 +01:00
Sebastiaan van Stijn 36441fc5f6
cli: NewTopLevelCommand: don't use unnamed assignments
This prevents unexpected bugs if fields are added/moved.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-28 13:09:35 +01:00
Sebastiaan van Stijn 81c68913e4
Merge pull request #3886 from thaJeztah/context_lazy_evaluate_step3
cli/command/context: "docker context show": don't validate context
2022-11-28 11:52:32 +01:00
Sebastiaan van Stijn ba501a411f
Merge pull request #3849 from thaJeztah/update_term
vendor: update github.com/moby/term to fix interrupt handling
2022-11-28 11:37:06 +01:00
Sebastiaan van Stijn 56580e7d9e
Merge pull request #3885 from thaJeztah/context_lazy_evaluate_step2
cli/command: add Cli.CurrentVersion() function
2022-11-28 11:36:31 +01:00
Sebastiaan van Stijn 6ba7de3b5a
cli/command/context: "docker context show": don't validate context
The "docker context show" command is intended to show the currently configured
context. While the context that's configured may not be valid (e.g., in case
an environment variable was set to configure the context, or if the context
was removed from the filesystem), we should still be able to _show_ the
context.

This patch removes the context validation, and instead only shows the context.
This can help in cases where the context is used to (e.g.) set the command-
prompt, but the user removed the context. With this change, the context name
can still be shown, but commands that _require_ the context will still fail.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-28 11:30:35 +01:00
Sebastiaan van Stijn a7e2c3ea1e
cli/command: add Cli.CurrentVersion() function
This internalizes constructing the Client(), which allows us to provide
fallbacks when trying to determin the current API version.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-28 10:49:01 +01:00
Sebastiaan van Stijn 536aef9c63
vendor: update github.com/moby/term to fix interrupt handling
On termios platforms, interrupt signals are not generated in raw mode terminals
as the ISIG setting is not enabled. Remove interrupt handler as it does nothing
for raw mode and prevents other uses of INT signal with this library.

This code seems to go back all the way to moby/moby#214 where signal handling was
improved for monolithic docker repository. Raw mode -ISIG got reintroduced in
https://github.com/moby/moby/commit/3f63b878076, but the INT handler was left
behind.

full diff: abb19827d3...c43b287e0e

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-28 10:28:21 +01:00
Sebastiaan van Stijn cbf052252b
Merge pull request #3883 from thaJeztah/protobuf_extensions_fix
vendor: golang_protobuf_extensions v1.0.4 - prevent incompatible versions
2022-11-25 16:01:47 +01:00
Sebastiaan van Stijn 756233029e
Merge pull request #3881 from thaJeztah/sam_curators
Add Sam Thibault (sam-thibault) as curator
2022-11-25 16:00:55 +01:00
Sebastiaan van Stijn a52d922f80
vendor: golang_protobuf_extensions v1.0.4 - prevent incompatible versions
This module made a whoopsie, and updated to `google.golang.org/protobuf`
in a patch release, but `google.golang.org/protobuf` is not backward
compatible with `github.com/golang/protobuf`.

Updating the minimum version to v1.0.4 which corrects this, to prevent
users of containerd as a module from accidentally pulling in the wrong
version:

- v1.0.3 switched to use `google.golang.org/protobuf`; https://github.com/matttproud/golang_protobuf_extensions/compare/v1.0.2..v1.0.3
- This was reverted in v1.0.4 (which is the same as v1.0.2); https://github.com/matttproud/golang_protobuf_extensions/compare/v1.0.3..v1.0.4
- And a `v2` was created instead; https://github.com/matttproud/golang_protobuf_extensions/releases/tag/v2.0.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-25 15:24:05 +01:00
Sebastiaan van Stijn 13493edcdb
Add Sam Thibault (sam-thibault) as curator
Sam is on my team, and we started to do weekly triage sessions to
clean up the backlog. Adding him, so that he can help with doing
triage without my assistance :)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-25 11:35:41 +01:00
Sebastiaan van Stijn d06aebf13e
Merge pull request #3870 from thaJeztah/update_version
Update version to v23.0.0-dev
2022-11-25 11:23:10 +01:00
Sebastiaan van Stijn da6b2ab9e1
docs: update version to v23.0.0-dev
As a stepping-stone towards switching to go modules, we're switching the
versioning scheme to be SemVer(ish) instead of CalVer. Note that this
currently still is `+incompatible` version, as changing to a version > 1
requires the module to be renamed, but changes in that area will arrive
in a future release.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-24 19:43:34 +01:00
Sebastiaan van Stijn 7c123d37c0
Update version to v23.0.0-dev
As a stepping-stone towards switching to go modules, we're switching the
versioning scheme to be SemVer(ish) instead of CalVer. Note that this
currently still is `+incompatible` version, as changing to a version > 1
requires the module to be renamed, but changes in that area will arrive
in a future release.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-24 19:43:32 +01:00
Sebastiaan van Stijn c0fa00e614
Merge pull request #3879 from thaJeztah/update_docker_engine
vendor: docker/docker v20.10.3-0.20221124164242-a913b5ad7ef1 (v23.0.0-dev)
2022-11-24 19:41:45 +01:00
Sebastiaan van Stijn 7d597de96e
vendor: docker/docker v20.10.3-0.20221124164242-a913b5ad7ef1 (v23.0.0-dev)
full diff: 99aa9bb766...a913b5ad7e

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-24 18:09:35 +01:00
Sebastiaan van Stijn dbffb29ff7
vendor: github.com/moby/swarmkit/v2 v2.0.0-20221123162438-b17f02f0a054
full diff: 6341884e5f...b17f02f0a0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-24 18:05:17 +01:00
Sebastiaan van Stijn 2080390f5b
Merge pull request #3878 from thaJeztah/current_context_improvements
context: don't validate context when looking up name
2022-11-22 17:06:20 +01:00
Sebastiaan van Stijn 9c42cd9a3e
cli/command: TestInitializeFromClientHangs fix unhandled error
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-22 16:44:09 +01:00
Sebastiaan van Stijn e36d5a0929
cli/command: DockerCli.CurrentContext: improve GoDoc
Also move the resolveContextName() function together with the
method for easier cross-referencing.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-22 14:27:44 +01:00
Sebastiaan van Stijn 793f09705d
cli/command: resolveContextName() move conflicting options check
There's no strict need to perform this validation inside this function;
validating flags should happen earlier, to allow faster detecting of
configuration issues (we may want to have a central config "validate"
function though).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-22 13:54:28 +01:00
Sebastiaan van Stijn 2f5698511a
cli/command: resolveContextName() don't validate if context exists
resolveContextName() is used to find which context to use, based on the
available configuration options. Once resolved, the context name is
used to load the actual context, which will fail if the context doesn't
exist, so there's no need to produce an error at this stage; only
check priority of the configuration options to pick the context
with the highest priority.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-22 13:53:10 +01:00
Sebastiaan van Stijn de52868abb
Merge pull request #3877 from thaJeztah/minor_context_cleanups
context: various minor cleanups and fixes
2022-11-22 13:34:35 +01:00
Sebastiaan van Stijn d0526ed5a7
Merge pull request #3876 from thaJeztah/merge_common_options
cli/flags: merge CommonOptions into ClientOptions
2022-11-22 13:14:30 +01:00
Sebastiaan van Stijn 592d90cafa
cli/command/context: minor cleanup in runList()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-22 12:57:57 +01:00
Sebastiaan van Stijn 0cc3f688d6
cli/command: use more descriptive const in test
On failures, the output wasn't clear which side was "expected" and
which side was "actual".

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-22 12:57:57 +01:00
Sebastiaan van Stijn acb934cc9d
cli/command: move default context description to context itself
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-22 12:57:54 +01:00
Sebastiaan van Stijn 3499669e18
cli/flags: merge CommonOptions into ClientOptions
CommonOptions was inherited from when the cli and daemon were in the same
repository, and some options would be shared between them. That's no longer
the case, and some options are even "incorrect" (for example, while the
daemon can be configured to run on multiple hosts, the CLI can only connect
with a single host / connection). This patch does not (yet) address that,
but merges the CommonOptions into the ClientOptions.

An alias is created for the old type, although it doesn't appear there's
any external consumers using the CommonOptions type (or its constructor).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-22 12:32:18 +01:00
Sebastiaan van Stijn 6a734df1cc
cli/context/store: make sure we handle wrapped errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-22 12:20:32 +01:00
Sebastiaan van Stijn 64e0a6cec6
Merge pull request #3874 from thaJeztah/update_engine2
go.mod: github.com/google/certificate-transparency-go v1.1.4 to remove replace rule
2022-11-21 21:59:43 +01:00