Граф коммитов

8285 Коммитов

Автор SHA1 Сообщение Дата
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
Sebastiaan van Stijn a51ce7ca9a
go.mod: github.com/google/certificate-transparency-go v1.1.4
Manually updating the indirect dependency to force go.etcd.io/etcd/server/v3
to v3.5.5 or up, which is now compatible with go.opentelemetry.io/otel v1.0.0.

With this, we can remove the replace rule for this module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-21 21:13:58 +01:00
Sebastiaan van Stijn 7d4450dbb5
vendor: docker 394f6c14add7c1a5a80257c9111f43b7edc78d0b / v22.06-dev
no changes to vendored code, just syncing with latest

full diff: d15be0c54d...394f6c14ad

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-21 14:59:17 +01:00
Sebastiaan van Stijn 5e8f8e407b
Merge pull request #3873 from thaJeztah/bump_moby_term
vendor: github.com/moby/term v0.0.0-20221120202655-abb19827d345
2022-11-21 14:56:19 +01:00
Sebastiaan van Stijn d4b51a3438
vendor: github.com/moby/term v0.0.0-20221120202655-abb19827d345
no significant changes in vendored code, other than updating build-tags
for go1.17, but removes some dependencies from the module, which can
help with future updates;

full diff: 3f7ff695ad...abb19827d3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-21 11:24:15 +01:00
Sebastiaan van Stijn 6fd4541757
Merge pull request #3869 from thaJeztah/update_gotestsum
update gotestsum to v1.8.2
2022-11-18 15:05:22 +01:00
Sebastiaan van Stijn 7c00dca83c
Merge pull request #3855 from matletix/master
Remove deprecated note about `docker logs` limitations
2022-11-18 15:04:58 +01:00
Mathieu Rollet 1158788c8c
Remove deprecated note
With dual logging enabled by default, `docker logs` works regardless of the logging driver used

Signed-off-by: Mathieu Rollet <matletix@gmail.com>
2022-11-18 09:58:28 +01:00
Sebastiaan van Stijn 700099159c
update gotestsum to v1.8.2
release notes: https://github.com/gotestyourself/gotestsum/releases/tag/v1.8.2

- Show shuffle seed
- Update tests, and cleanup formats
- Update dependencies
- Test against go1.19, remove go1.15
- Add project name to junit.xml output
- Adding in support for s390x and ppc64le

full diff: https://github.com/gotestyourself/gotestsum/compare/v1.8.1...v1.8.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-17 18:08:19 +01:00
Sebastiaan van Stijn da7bf25f52
Merge pull request #3835 from dvdksn/docs/inspect-size-example
docs: docker inspect --size
2022-11-17 16:46:42 +01:00