Add a basic helper to provide the equivalent of passphrase.ConstantRetriever
with a fixed passphrase for testing.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This var used to be vendored from github.com/docker/docker/registry, but was
removed there, and made a local var in a1cbaa827b.
It is (and should never be) modified, so let's change it into a const.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- Don't allow unbounded amounts of splits.
Fixes GHSA-c6gw-w398-hv78 / CVE-2025-27144
- Various other dependency updates, small fixes, and documentation
updates in the full changelog
full diff: https://github.com/go-jose/go-jose/compare/v4.0.4...v4.0.5
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- set default to 28
- remove minor version from matrix; docker:dind images also provide a
"docker:28-dind" which point to the latest minor version.
- remove TODO for 19.03, which is really out of scope now.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Not all flags have completions yet, and for those that don't have completion,
we disable completion to prevent it completing with filenames.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Change completion for nodes to use names by default, and bring back
support for the `DOCKER_COMPLETION_SHOW_NODE_IDS` env-var
f9ced58158/contrib/completion/bash/docker (L38)
With this patch:
docker node ps <tab>
docker-desktop self
export DOCKER_COMPLETION_SHOW_NODE_IDS=yes
docker node ps <TAB>
docker-desktop qyeriqk20al6hy4y869d08ff5 self
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The errors.Wrap and errors.Wrapf functions gracefully handle nil-errors.
This allows them to be used unconditionally regardless if an error
was produced.
While this can be convenient, it can also be err-prone, as replacing
these with stdlib errors means they unconditionally produce an error.
This patch replaces code uses of errors.Wrap to be gated by a check
for nil-errors to future-proof our code.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Before 2b9a4d5f4c, this function
would use "errors.Wrap" which returns nil if the original error
was nil. fmt.Errorf does not do this, so without a nil check,
it would unconditionally return an error;
docker context create arm64 --docker host=ssh://172.17.101.26,skip-tls-verify=False
unable to create docker endpoint config: name: %!w(<nil>)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Change completion for services to use names by default, and bring back
support for the `DOCKER_COMPLETION_SHOW_SERVICE_IDS` env-var
f9ced58158/contrib/completion/bash/docker (L41-L43)
Before this patch:
docker service ps
c9vrp2pwni9gx5ghat20rjpcy hmthf0tqws9xpmd87ok7diqly
With this patch:
docker service ps<TAB>
databaseservice webservice
export DOCKER_COMPLETION_SHOW_SERVICE_IDS=yes
docker service ps<TAB>
c9vrp2pwni9gx5ghat20rjpcy databaseservice hmthf0tqws9xpmd87ok7diqly webservice
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Remove the `docker.cli` prefixed attributes from
`OTEL_RESOURCE_ATTRIBUTES` after the telemetry provider has been created
within a plugin. This prevents accidentally sending the attributes to
something downstream for the user.
This also fixes an issue with compose where the self-injected `OTEL_RESOURCE_ATTRIBUTES`
would override an existing attribute in the environment file because the
"user environment" overrode the environment file, but the "user
environment" was created by the `docker` tool rather than by the user's
environment.
When `OTEL_RESOURCE_ATTRIBUTES` is empty after pruning, the environment
variable is unset.
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
Merge `OTEL_RESOURCE_ATTRIBUTES` when there is one already in the
environment. This allows user-specified resource attributes to be passed
on to CLI plugins while still allowing the extra attributes added for
telemetry information.
This was the original intended use-case but it seems to have never made
it in. The reason `OTEL_RESOURCE_ATTRIBUTES` was used is because we
could combine it with user-centric ones.
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
WARN The linter 'tenv' is deprecated (since v1.64.0) due to: Duplicate feature another linter. Replaced by usetesting.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The regex was added before we migrateed from gometalinter in
dbd96badb6, and got migrated to golangci-lint
in b7e06f2845. The format used for the config
was invalid, and migrating it to the right format didn't make a difference,
so we can remove it.
As naked returns are generally not desirable, also setting the minimum func
length to 0 (i.e., don't allow any naked returns), instead of the default
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
cli/command/container/cp.go:206:3: naked return in func `resolveLocalPath` with 5 lines of code (nakedret)
return
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
cli/internal/oauth/jwt.go:62:3: naked return in func `GetClaims` with 9 lines of code (nakedret)
return
^
cli/internal/oauth/jwt.go:67:2: naked return in func `GetClaims` with 9 lines of code (nakedret)
return
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Also fix some unhandled errors
cli/debug/debug_test.go:12:3: os.Setenv() could be replaced by t.Setenv() in TestEnable (usetesting)
os.Setenv("DEBUG", "")
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>