These utility functions were added in 8890a1c929,
and are all related to OTEL. The ResourceAttributesEnvvar const defines
the "OTEL_RESOURCE_ATTRIBUTES" environment-variable to use, which is part
of the [OpenTelemetry specification], so should be considered a well-known
env-var, and not up to us to define a const for. These code-changes were not
yet included in a release, so we don't have to deprecate.
This patch:
- Moves the utility functions to the telemetry files, so that all code related
to OpenTelemetry is together.
- Un-exports the ResourceAttributesEnvvar to reduce our public API.
- Un-exports the DockerCliAttributePrefix to reduce depdency on cli/command
in CLI-plugins, but adds a TODO to move telemetry-related code to a common
(internal) package.
- Deprecates the cli-plugins/manager.ResourceAttributesEnvvar const. This
const has no known consumers, so we could skip deprecation, but just in
case some codebase uses this.
[OpenTelemetry specification]: https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#general-sdk-configuration
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The client was only using the Actions consts, but the trust package
also has a dependency on notary. Remove the import to prevent Notary
becoming a dependency for uses of the cli code.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This uuid package was introduced in 89db01ef97,
but we want to reduce dependency on the old docker/distribution module.
Replace it with google/uuid, which is a commonly used module for this
and already a dependency.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This utility was shared between the "image" and "trust" packages, and a
shallow wrapper around features in the cli/trust package. Move it there
instead and rename it to `trust.AddToAllSignableRoles`.
There are no known external consumers of this utility, so skipping a
deprecation.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
These tests were not testing functionality that was implemented
in the image package. Move them to the trust package, where
they belong.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This test was only testing trust.GetSignableRoles to return an error
if it's offline, which was duplicating the [TestGetSignableRolesError]
test in the cli/trust package.
[TestGetSignableRolesError]: fe0a8d2791/cli/trust/trust_test.go (L49-L55)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
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 test was only testing trust.GetSignableRoles to return an error
if it's offline, which was duplicating the [TestGetSignableRolesError]
test.
[TestGetSignableRolesError]: fe0a8d2791/cli/trust/trust_test.go (L49-L55)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This test was only testing trust.GetSignableRoles to return an error
if it's offline, which was duplicating the [TestGetSignableRolesError]
test.
[TestGetSignableRolesError]: fe0a8d2791/cli/trust/trust_test.go (L49-L55)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The test only validates that an error is produced because the notary
server is offline, and does not sent a passphrase.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
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>
[ParseRepositoryInfo] parses an image reference and returns information
about the Repository and the registry. As part of this, it validates if
the registry's hostname is considered valid using [ValidateIndexName],
as well as normalizing the image reference to strip tags and digests
using [reference.TrimNamed].
ValidateIndexName only provides very limited value; the only validation
happening is to check for the hostname to not start, or end with a hyphen.
The cli/command/manifest package used ParseRepositoryInfo in various
locations where only the repository name was used (i.e., the result
of `reference.TrimNamed` on the given reference), and in one location
only used it to validate the registry name.
For buildPushRequest, the call was fully redundant, as [RepoNameForReference]
was used on the result, calling [newDefaultRepositoryEndpoint], which
uses ParseRepositoryInfo internally, so we were only repeating that work.
This patch removes uses of ParseRepositoryInfo in those places, and instead
calling [reference.TrimNamed] directly.
[ParseRepositoryInfo]: 41f781fab3/registry/config.go (L375-L381)
[ValidateIndexName]: 41f781fab3/registry/config.go (L288-L299)
[reference.TrimNamed]: 41f781fab3/registry/config.go (L369)
[RepoNameForReference]: fe0a8d2791/cli/registry/client/endpoint.go (L107-L110)
[newDefaultRepositoryEndpoint]: fe0a8d2791/cli/registry/client/endpoint.go (L33-L38)
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>