Commit Graph

11776 Commits

Author SHA1 Message Date
Paweł Gronowski 27b316fc0d
Merge pull request #6421 from vvoland/update-go
update to go1.24.7
2025-09-03 21:28:52 +02:00
Paweł Gronowski f64b8a332d
update to go1.24.7
This includes 1 security fix:

- net/http: CrossOriginProtection bypass patterns are over-broad

    When passing patterns to CrossOriginProtection.AddInsecureBypassPattern,
    requests that would have redirected to those patterns (e.g. without a trailing
    slash) were also exempted, which might be unexpected.

    Thanks to Marco Gazerro for reporting this issue.

    This is CVE-2025-47910 and Go issue https://go.dev/issue/75054.

View the release notes for more information:
https://go.dev/doc/devel/release#go1.24.7

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-03 20:40:59 +02:00
Sebastiaan van Stijn 06ed23d5fe
Merge pull request #6419 from thaJeztah/complete_pull
add completion for docker image pull
2025-09-03 17:34:50 +02:00
Sebastiaan van Stijn 5bf3c6793d
add completion for docker image pull
With this patch, completion is provided for images already present
in the local image cache to help pulling the latest version of the
same tag;

    docker pull go<tab>
    golang:1.12    golang:1.18.0  golang:1.21    golang:1.24    gopher:latest
    golang:1.13    golang:1.20    golang:1.23    golang:latest

    docker pull golang:<tab>
    1.12    1.13    1.18.0  1.20    1.21    1.23    1.24    latest

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-03 15:39:41 +02:00
Austin Vazquez 5bce5e17af
Merge pull request #6415 from thaJeztah/plugin_no_regex
cli-plugins/manager: replace pluginNameRe for isValidPluginName utility
2025-09-02 16:48:11 -07:00
Austin Vazquez 0640306406
Merge pull request #6417 from thaJeztah/context_no_regex
cli/context/store: replace restrictedNamePattern for isValidName utility
2025-09-02 16:45:21 -07:00
Sebastiaan van Stijn ab7018b590
cli/context/store: replace restrictedNamePattern for isValidName utility
The restrictedNamePattern was a basic regular expression. Replace it
with a minimal utility to do the same, without having to use regular
expressions (or the "lazyregexp" package).

Some quick benchmarking (not committed) show that the non-regex approach
is ~18x faster:

    BenchmarkIsValidName_Regex_Valid-10        8516511        119.4   ns/op      0 B/op        0 allocs/op
    BenchmarkIsValidName_Manual_Valid-10     172426240          6.964 ns/op      0 B/op        0 allocs/op

    BenchmarkIsValidName_Regex_Invalid-10     34824540         34.22  ns/op      0 B/op        0 allocs/op
    BenchmarkIsValidName_Manual_Invalid-10   550804021          2.173 ns/op      0 B/op        0 allocs/op

    BenchmarkIsValidName_Regex_Parallel-10    69289900         17.30   ns/op     0 B/op        0 allocs/op
    BenchmarkIsValidName_Manual_Parallel-10 1000000000          0.9296 ns/op     0 B/op        0 allocs/op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-02 23:09:12 +02:00
Sebastiaan van Stijn 2351f5b915
cli-plugins/manager: replace pluginNameRe for isValidPluginName utility
The pluginNameRe was a basic regular expression, effectively only checking
if the name consisted of lowercase alphanumeric characters. Replace it
with a minimal utility to do the same, without having to use regular
expressions (or the "lazyregexp" package).

Some quick benchmarking (not committed) show that the non-regex approach
is ~25x faster:

    BenchmarkIsValidPluginName_Regex_Valid-10       13956240        81.39  ns/op       0 B/op        0 allocs/op
    BenchmarkIsValidPluginName_Manual_Valid-10     360003060         3.318 ns/op       0 B/op        0 allocs/op

    BenchmarkIsValidPluginName_Regex_Invalid-10     35281794        33.74  ns/op       0 B/op        0 allocs/op
    BenchmarkIsValidPluginName_Manual_Invalid-10   906072663         1.320 ns/op       0 B/op        0 allocs/op

    BenchmarkIsValidPluginName_Regex_Parallel-10    96595677        12.04  ns/op       0 B/op        0 allocs/op
    BenchmarkIsValidPluginName_Manual_Parallel-10  1000000000        0.4541 ns/op      0 B/op        0 allocs/op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-02 22:58:32 +02:00
Sebastiaan van Stijn 153bd95158
Merge pull request #6414 from thaJeztah/plugin_rm_deprecated
cli-plugins/manager: remove deprecated types, functions and aliases
2025-09-02 12:17:31 +02:00
Sebastiaan van Stijn ce72a5c28b
cli-plugins/manager: remove deprecated metadata aliases
These consts and types were moved to a separate metadata package in commits
292713c887 and 4321293972,
and deprecated in 72f76f2720, 5876b2941c,
and 6fa7d18320.

This removes the deprecated aliases in `cli-plugins/manager` in favor of
their equivalent in `cli-plugins/manager/metadata`:

- `CommandAnnotationPlugin`
- `CommandAnnotationPluginVendor`
- `CommandAnnotationPluginVersion`
- `CommandAnnotationPluginInvalid`
- `CommandAnnotationPluginCommandPath`
- `NamePrefix`
- `MetadataSubcommandName`
- `HookSubcommandName`
- `Metadata`
- `ReexecEnvvar`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-02 11:43:32 +02:00
Sebastiaan van Stijn d54c7f9e63
cli-plugins/manager: remove deprecated IsNotFound
These errors satisfy errdefs.IsNotFound, which can be used instead. This
function was deprecated in 71460215d3 and
is no longer used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-01 18:31:41 +02:00
Paweł Gronowski 6ec32660e9
Merge pull request #6412 from thaJeztah/deprecate_OauthLoginEscapeHatchEnvVar
cli/command/registry: deprecate OauthLoginEscapeHatchEnvVar
2025-09-01 17:57:31 +02:00
Paweł Gronowski 9e52a2817c
Merge pull request #6410 from thaJeztah/deprecate_ReexecEnvvar
cli-plugins/manager: deprecate ReexecEnvvar
2025-09-01 17:56:42 +02:00
Sebastiaan van Stijn 18cdc25bb4
cli/command/registry: deprecate OauthLoginEscapeHatchEnvVar
This const was added in 846ecf59ff, but
only used internally. This patch deprecates the const, to be removed
in the next release.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-01 17:43:39 +02:00
Sebastiaan van Stijn 6fa7d18320
cli-plugins/manager: deprecate ReexecEnvvar
This alias was added in 4321293972, which is
part of v28.0, but did not deprecate them. They are no longer used in the
CLI itself, but may be used by cli-plugin implementations.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-01 17:33:32 +02:00
Sebastiaan van Stijn 89874983c8
Merge pull request #6401 from thaJeztah/check_DisableFlagsInUseLine
verify that DisableFlagsInUseLine is set for all commands
2025-09-01 13:55:57 +02:00
Sebastiaan van Stijn 88f68273fd
Merge pull request #6406 from thaJeztah/rm_GetStacks_StackWrite
cli/command/stack: move GetStacks and StackWrite internal
2025-09-01 13:55:09 +02:00
Sebastiaan van Stijn a2c886251c
Merge pull request #6407 from thaJeztah/rm_exported_context_funcs
cli/command/context: remove deprecated types and functions
2025-09-01 12:58:49 +02:00
Sebastiaan van Stijn 9a6cbbc586
Merge pull request #6408 from thaJeztah/rm_NoComplete
cli/command/completion: remove deprecated NoComplete
2025-09-01 12:58:20 +02:00
Sebastiaan van Stijn 70915196cb
cli/command/completion: remove deprecated NoComplete
This function was an exact duplicate of [cobra.NoFileCompletions], and
was deprecated in 2827d037ba.

[cobra.NoFileCompletions]: https://pkg.go.dev/github.com/spf13/cobra@v1.9.1#NoFileCompletions

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-01 10:27:34 +02:00
Sebastiaan van Stijn 9477941c20
cli/command/context: remove deprecated types and functions
These functions and types are shallow wrappers around the context
store and were intended for internal use as implementation for the
CLI itself.

They were exported in 3126920af1 to be
used by plugins and Docker Desktop. However, there's currently no public
uses of this, and Docker Desktop does not use these functions. These were
deprecated in 95eeafa551 and are no longer
used.

This patch removes the deprecated functions as they were meant to be
implementation specific for the CLI. If there's a need to provide
utilities for manipulating the context-store other than through the
CLI itself, we can consider creating an SDK for that purpose.

This removes:

- `RunCreate` and `CreateOptions`
- `RunExport` and `ExportOptions`
- `RunImport`
- `RunRemove` and `RemoveOptions`
- `RunUpdate` and `UpdateOptions`
- `RunUse`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-01 10:22:28 +02:00
Sebastiaan van Stijn 6647e229be
cli/command/stack: move GetStacks and StackWrite internal
These were deprecated in 036d3a6bab and
30774ed1f2, and were originally in the
cli/command/stack package, but moved for the (now deprecated) Compose
on Kubernetes feature in 4d947de292.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-01 09:40:44 +02:00
Sebastiaan van Stijn 0adaf6be3b
verify that DisableFlagsInUseLine is set for all commands
This replaces the visitAll recursive function with a test that verifies that
the option is set for all commands and subcommands, so that it doesn't have
to be modified at runtime.

We currently still have to loop over all functions for the setValidateArgs
call, but that can be looked at separately.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-01 09:39:46 +02:00
Sebastiaan van Stijn ba21666654
Merge pull request #6404 from thaJeztah/deprecate_nocomplete
cli/command/completion: deprecate NoComplete
2025-09-01 09:13:18 +02:00
Sebastiaan van Stijn 321100e38b
Merge pull request #6402 from thaJeztah/deprecate_context_funcs
cli/command/context: deprecate exported types and functions
2025-09-01 09:11:28 +02:00
Sebastiaan van Stijn 5dd52a9efa
Merge pull request #6397 from thaJeztah/compose_clean
cli/compose/convert: split exported AddStackLabel from implementation
2025-09-01 09:10:42 +02:00
Sebastiaan van Stijn 2827d037ba
cli/command/completion: deprecate NoComplete
This function was an exact duplicate of [cobra.NoFileCompletions], so
deprecating it in favor of that.

[cobra.NoFileCompletions]: https://pkg.go.dev/github.com/spf13/cobra@v1.9.1#NoFileCompletions

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-30 12:00:34 +02:00
Sebastiaan van Stijn 95eeafa551
cli/command/context: deprecate exported types and functions
These functions and types are shallow wrappers around the context
store and were intended for internal use as implementation for the
CLI itself.

They were exported in 3126920af1 to be
used by plugins and Docker Desktop. However, there's currently no public
uses of this, and Docker Desktop does not use these functions.

This patch deprecates the exported functions as they were meant to be
implementation specific for the CLI. If there's a need to provide
utilities for manipulating the context-store other than through the
CLI itself, we can consider creating an SDK for that purpose.

This deprecates:

- `RunCreate` and `CreateOptions`
- `RunExport` and `ExportOptions`
- `RunImport`
- `RunRemove` and `RemoveOptions`
- `RunUpdate` and `UpdateOptions`
- `RunUse`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-30 01:51:12 +02:00
Rob Murray 81ea282e00
Merge pull request #6398 from thaJeztah/rm_deprecated_stack
cli/command/stack: remove some deprecated functions
2025-08-29 17:23:29 +01:00
Paweł Gronowski 0155c264ae
Merge pull request #6371 from Benehiko/support-fallback-negative-certs
Add escape hatch for GODEBUG=x509negativeserial
2025-08-29 15:59:24 +02:00
Sebastiaan van Stijn 77205e782a
cli/command/stack/swarm: deployServices: use struct-literal for options
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-29 14:52:38 +02:00
Sebastiaan van Stijn 580c3aa218
cli/compose/convert: Networks: use struct-literal for IPAM config
Use a struct-literal for the IPAM config, and combine some of the checks.
Also use the Name field as a default, and only construct a scoped name
if the given name is empty (instead of the reverse).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-29 14:50:49 +02:00
Sebastiaan van Stijn f8d33f4602
cli/compose/convert: split exported AddStackLabel from implementation
This function is currently only used within the package; create a non-exported
version of it, to make it clear it's not used elsewhere. This patch keeps
the exported function for now, but we can decide if we need to keep it
in future.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-29 14:50:46 +02:00
Sebastiaan van Stijn 2066dbcfe8
cli/command/stack/swarm: inline validateResolveImageFlag
It was only used in a single place, and possibly incorrect. Let's inline
it to put the logic where it's used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-29 14:39:06 +02:00
Sebastiaan van Stijn c3be589c16
cli/command/stack/swarm: remove deprecated RunPS and options.PS
These were deprecated in f0e5a0d654 and
036d3a6bab and were only used internally.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-29 14:39:06 +02:00
Sebastiaan van Stijn 2a05951680
cli/command/stack: remove deprecated RunServices and swarm.GetServices
These were deprecated in f0e5a0d654,
036d3a6bab, and
d16c560664 and were only used internally.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-29 14:39:00 +02:00
Alano Terblanche 72f79333e5
return early if GODEBUG set or context is default
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
2025-08-29 14:31:21 +02:00
Alano Terblanche 6163c03b11
rename function to fit what it is doing
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
2025-08-29 14:08:15 +02:00
Alano Terblanche 467305fcea
Test setAllowNegativex509
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
2025-08-29 12:15:49 +02:00
Alano Terblanche 65a6c35d90
Cleanup setAllowNegativex509
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
2025-08-29 12:15:29 +02:00
Sebastiaan van Stijn c4df0d17bb
cli/command/stack: remove deprecated RunList and options.List
These were deprecated in f0e5a0d654 and
d16c560664 and were only used internally.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-29 11:46:21 +02:00
Sebastiaan van Stijn b3cd9d48fe
Merge pull request #6393 from thaJeztah/cleanup_stacks
cli/command/stack: cleanups and optimizations
2025-08-29 11:22:11 +02:00
Sebastiaan van Stijn 581cb2b70a
cli/command/stack/swarm: GetStacks: don't use pointers for values
These are very small structs, so using pointers doesn't bring much
advantage and makes it slightly more cumbersome to use.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-28 15:44:09 +02:00
Sebastiaan van Stijn 6b86aac02e
cli/command/stack/formatter: StackWrite: remove intermediate vars
- inline the closure
- remove newStackContext() constructor and inline it

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-28 15:37:52 +02:00
Sebastiaan van Stijn 8b01d8e74c
cli/command/stack: runList: remove intermediate slice
This intermediate slice was a left-over from the "Compose on Kubernetes"
feature, which required some conversions, but that code was removed in
193ede9b12, so the intermediate slice no
longer has a purpose.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-28 15:23:40 +02:00
Sebastiaan van Stijn 047ea37054
cli/command/stack/swarm: pruneServices: fix typo and minor cleanup
- fix typo in argument name
- rename var that shadowed function
- pre-allocate slice

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-28 15:22:16 +02:00
Sebastiaan van Stijn 4f7f42df0e
cli/command/stack/swarm: GetStacks: tidy up
Preserve the original order by avoiding the intermediate map[string] and
keeping an index for the first occurrence of a stack; this also avoids
looping multiple times.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-28 15:22:12 +02:00
Sebastiaan van Stijn 5a23ff9b17
cli/command/stack/formatter: TestStackContextWrite: cleanup test
- Include name in test-table
- Don't use un-keyed values in struct
- Simplify test-table to take a format string instead of a whole formatter.Context

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-28 15:21:16 +02:00
Paweł Gronowski 8f25f4fb24
Merge pull request #6389 from thaJeztah/deprecate_stack_commands
cli/command/stack/*: deprecate exported functions and types
2025-08-28 13:55:46 +02:00
Sebastiaan van Stijn d16c560664
cli/command/stack: deprecate RunList, RunServices
Functions and types in this package were exported as part of the "compose
on kubernetes" feature, which was deprecated and removed. These functions
are meant for internal use, and will be removed in the next release.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-28 10:21:47 +02:00