Commit Graph

8523 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 66c66bdce7
cli/command/config: fakeClient: include context in fake client (revive)
I could either remove the name for these contexts, or make the fake functions
more accurately reflect the actual implementation (decided to go for the latter
one)

.   cli/command/config/client_test.go:19:35: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
    func (c *fakeClient) ConfigCreate(ctx context.Context, spec swarm.ConfigSpec) (types.ConfigCreateResponse, error) {
                                      ^
    cli/command/config/client_test.go:26:43: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
    func (c *fakeClient) ConfigInspectWithRaw(ctx context.Context, id string) (swarm.Config, []byte, error) {
                                              ^
    cli/command/config/client_test.go:33:33: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
    func (c *fakeClient) ConfigList(ctx context.Context, options types.ConfigListOptions) ([]swarm.Config, error) {
                                    ^
    cli/command/config/client_test.go:40:35: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
    func (c *fakeClient) ConfigRemove(ctx context.Context, name string) error {
                                      ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-30 17:05:32 +02:00
Sebastiaan van Stijn ac024a4d8b
internal/test/network: FakeClient: embed interface to remove boilerplating
Only a single method of the FakeClient was actually implemented (and used).
This patch embeds the interface it must implement to reduce the boilerplating
for not yet implemented methods.

Calling any of the unimplemented methods will result in a panic, which will
make it clear when they must be implemented :)

This also fixes various linting errors;

    internal/test/network/client.go:17:37: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
    func (c *FakeClient) NetworkConnect(ctx context.Context, networkID, container string, config *network.EndpointSettings) error {
                                        ^
    internal/test/network/client.go:22:65: unused-parameter: parameter 'options' seems to be unused, consider removing or renaming it as _ (revive)
    func (c *FakeClient) NetworkCreate(_ context.Context, _ string, options types.NetworkCreate) (types.NetworkCreateResponse, error) {
                                                                    ^
    internal/test/network/client.go:27:40: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
    func (c *FakeClient) NetworkDisconnect(ctx context.Context, networkID, container string, force bool) error {
                                           ^
    internal/test/network/client.go:45:53: unused-parameter: parameter 'options' seems to be unused, consider removing or renaming it as _ (revive)
    func (c *FakeClient) NetworkList(_ context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error) {
                                                        ^
    internal/test/network/client.go:50:36: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
    func (c *FakeClient) NetworkRemove(ctx context.Context, networkID string) error {
                                       ^
    internal/test/network/client.go:55:55: unused-parameter: parameter 'pruneFilter' seems to be unused, consider removing or renaming it as _ (revive)
    func (c *FakeClient) NetworksPrune(_ context.Context, pruneFilter filters.Args) (types.NetworksPruneReport, error) {
                                                          ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-30 17:05:31 +02:00
Sebastiaan van Stijn a2d532819d
cli/trust: remove name for unused args (revive)
These method must implements an interface, but don't use the argument.

    cli/trust/trust.go:85:40: unused-parameter: parameter 'u' seems to be unused, consider removing or renaming it as _ (revive)
    func (scs simpleCredentialStore) Basic(u *url.URL) (string, string) {
                                           ^
    cli/trust/trust.go:89:47: unused-parameter: parameter 'u' seems to be unused, consider removing or renaming it as _ (revive)
    func (scs simpleCredentialStore) RefreshToken(u *url.URL, service string) string {
                                                  ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-30 17:05:31 +02:00
Sebastiaan van Stijn f5fad186c0
opts: NormalizeCapability(): fix redefinition of the built-in function (revive)
opts/capabilities.go:25:2: redefines-builtin-id: redefinition of the built-in function cap (revive)
        cap = strings.ToUpper(strings.TrimSpace(cap))
        ^
    opts/capabilities.go:30:3: redefines-builtin-id: redefinition of the built-in function cap (revive)
            cap = "CAP_" + cap
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-30 17:05:31 +02:00
Sebastiaan van Stijn 9252fae838
cli/registry/client: AuthorizeRequest(): remove name for unused arg (revive)
This method implements the interface defined in distribution, but doesn't
use the argument.

    cli/registry/client/endpoint.go:123:69: unused-parameter: parameter 'params' seems to be unused, consider removing or renaming it as _ (revive)
    func (th *existingTokenHandler) AuthorizeRequest(req *http.Request, params map[string]string) error {
                                                                        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-30 17:05:31 +02:00
Sebastiaan van Stijn 92506afd49
cli/command/service/progress: remove name for unused parameter (revive)
This function must match the interface, but doesn't use the firs argument.

    cli/command/service/progress/progress.go:417:40: unused-parameter: parameter 'service' seems to be unused, consider removing or renaming it as _ (revive)
    func (u *globalProgressUpdater) update(service swarm.Service, tasks []swarm.Task, activeNodes map[string]struct{}, rollback bool) (bool, error) {
                                           ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-30 17:05:31 +02:00
Sebastiaan van Stijn c3d7f167bd
cli/command: RunPrune(): remove name for unused "all" parameter (revive)
These functions must have the same signature, but only some of them accept
an "all" boolean argument;
88924b1802/cli/command/system/prune.go (L79)

    cli/command/container/prune.go:78:38: unused-parameter: parameter 'all' seems to be unused, consider removing or renaming it as _ (revive)
    func RunPrune(dockerCli command.Cli, all bool, filter opts.FilterOpt) (uint64, string, error) {
                                         ^
    cli/command/network/prune.go:73:38: unused-parameter: parameter 'all' seems to be unused, consider removing or renaming it as _ (revive)
    func RunPrune(dockerCli command.Cli, all bool, filter opts.FilterOpt) (uint64, string, error) {
                                         ^
    cli/command/volume/prune.go:78:38: unused-parameter: parameter 'all' seems to be unused, consider removing or renaming it as _ (revive)
    func RunPrune(dockerCli command.Cli, all bool, filter opts.FilterOpt) (uint64, string, error) {
                                         ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-30 17:05:30 +02:00
Sebastiaan van Stijn b4aff3a14d
cli/command/completion: NoComplete(): remove unused argument (revive)
cli/command/completion/functions.go:97:17: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
    func NoComplete(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
                    ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-30 17:05:30 +02:00
Sebastiaan van Stijn f08252c10a
cli/command/stack: deprecate now obsolete wrappers
These wrappers were added to abstract stack deploy to k8s and swarm. Now
that support for deploying to k8s was removed, we can remove these wrappers.

This deprecates:

- RunDeploy()
- RunPs()
- RunRemove()
- GetServices()

This also addresses some linting failers, due to these functions having
unused arguments:

    cli/command/stack/deploy.go:51:39: unused-parameter: parameter 'flags' seems to be unused, consider removing or renaming it as _ (revive)
    func RunDeploy(dockerCli command.Cli, flags *pflag.FlagSet, config *composetypes.Config, opts options.Deploy) error {
                                              ^
    cli/command/stack/ps.go:42:35: unused-parameter: parameter 'flags' seems to be unused, consider removing or renaming it as _ (revive)
    func RunPs(dockerCli command.Cli, flags *pflag.FlagSet, opts options.PS) error {
                                      ^
    cli/command/stack/remove.go:35:39: unused-parameter: parameter 'flags' seems to be unused, consider removing or renaming it as _ (revive)
    func RunRemove(dockerCli command.Cli, flags *pflag.FlagSet, opts options.Remove) error {
                                          ^
    cli/command/stack/list.go:37:14: unused-parameter: parameter 'cmd' seems to be unused, consider removing or renaming it as _ (revive)
    func RunList(cmd *cobra.Command, dockerCli command.Cli, opts options.List) error {
                 ^
    cli/command/stack/services.go:56:41: unused-parameter: parameter 'flags' seems to be unused, consider removing or renaming it as _ (revive)
    func GetServices(dockerCli command.Cli, flags *pflag.FlagSet, opts options.Services) ([]swarmtypes.Service, error) {
                                            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-30 17:05:29 +02:00
Sebastiaan van Stijn 78c474539b
cli/command/context: remove redundant if ...; err != nil check (revive)
cli/command/context/create.go:121:2: if-return: redundant if ...; err != nil check, just return error instead. (revive)
        if err := s.ResetTLSMaterial(o.Name, &contextTLSData); err != nil {
            return err
        }

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-30 17:05:29 +02:00
Sebastiaan van Stijn be97731f1a
cli/command/container: fix redefinition of the built-in function close (revive)
cli/command/container/run.go:176:3: redefines-builtin-id: redefinition of the built-in function close (revive)
            close, err := attachContainer(ctx, dockerCli, &errCh, config, createResponse.ID)
            ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-30 17:05:29 +02:00
Sebastiaan van Stijn a9fff59809
Merge pull request #4129 from crazy-max/fix-perf-reg-2
improve and load plugin command stubs when required
2023-03-30 17:05:16 +02:00
Sebastiaan van Stijn 378e35e915
Merge pull request #4138 from thaJeztah/fix_go_version
gha: align stray go 1.19.4 version
2023-03-30 17:02:52 +02:00
Sebastiaan van Stijn e4436853e8
gha: align stray go 1.19.4 version
looks like this one was forgotten to be updated :)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-30 16:50:29 +02:00
Sebastiaan van Stijn fc6703bd3d
Merge pull request #4121 from developerjake/fix-docs-grammar
Fix grammar in docs by adding omitted word
2023-03-30 15:37:15 +02:00
Jake Stokes 9335690a66
Fix grammar in docs by adding omitted word
Edited second paragraph under ### Daemon configuration file to change "regardless their value" to "regardless of their value"

Signed-off-by: Jake Stokes <contactjake@developerjake.com>
2023-03-30 15:19:55 +02:00
Sebastiaan van Stijn 88924b1802
Merge pull request #4133 from thaJeztah/engine_23.0.2
vendor: github.com/docker/docker v23.0.2
2023-03-29 13:29:45 +02:00
Sebastiaan van Stijn a39958846d
vendor: github.com/docker/docker v23.0.2
- migrate away from things deprecated in Go 1.20 (removes use of archive/tar.TypeRegA)

full diff: https://github.com/docker/docker/compare/v23.0.1...v23.0.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-28 18:35:05 +02:00
Sebastiaan van Stijn 69c54641f7
Merge pull request #4130 from crazy-max/ci-split-build
ci: enhanced build workflow
2023-03-28 17:33:38 +02:00
Kevin Alvarez c39c711a18
load plugin command stubs when required
We are currently loading plugin command stubs for every
invocation which still has a significant performance hit.
With this change we are doing this operation only if cobra
completion arg request is found.

- 20.10.23: `docker --version` takes ~15ms
- 23.0.1: `docker --version` takes ~93ms

With this change `docker --version` takes ~9ms

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-28 06:16:55 +02:00
CrazyMax 62f2358b99
improve plugins discovery performance
We are currently loading plugin commands stubs for every
command invocation to add support for Cobra v2 completion.
This cause a significant performance hit if there is a
lot of plugins in the user space (7 atm in Docker Desktop):

`docker --version` takes in current 23.0.1 ~93ms

Instead of removing completion for plugins to fix the
regression, we can slightly improve plugins discovery by
spawning a goroutine for each iteration in the loop when
listing plugins:

`docker --version` now takes ~38ms

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-28 06:16:55 +02:00
CrazyMax bebdb6fa2a
ci: enhanced build workflow
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-28 04:59:09 +02:00
Sebastiaan van Stijn 21653863b1
Merge pull request #4122 from crazy-max/fix-bake
don't use null values in the bake definition
2023-03-27 16:10:16 +02:00
CrazyMax bec5d37e91
don't use null values in the bake definition
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-27 14:32:14 +02:00
Sebastiaan van Stijn 7f11449f35
Merge pull request #4123 from crazy-max/e2e-fix-certs
e2e: update notary certificates
2023-03-27 14:01:10 +02:00
CrazyMax b201ce5efd
e2e: update notary certificates
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-27 13:28:00 +02:00
CrazyMax c6c33380da
e2e: increase tests certificates duration (10 years)
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-27 13:28:00 +02:00
CrazyMax d234a81de7
bake target to generate certs for e2e tets
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-27 13:27:59 +02:00
Sebastiaan van Stijn 59ec357996
Merge pull request #4117 from crazy-max/align-go-ver
Dockerfile: align go version
2023-03-26 16:56:33 +02:00
CrazyMax b854eff300
Dockerfile: align go version
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-24 21:11:53 +01:00
Sebastiaan van Stijn f5d698a331
Merge pull request #4114 from thaJeztah/remove_registry_service_step2
cli/trust: remove special handling for "plugin" Class
2023-03-23 19:34:49 +01:00
Sebastiaan van Stijn 0ba820ed0b
cli/trust: remove special handling for "plugin" Class
This code depended on the registry Service interface, which has been removed,
so needed to be refactored. Digging further into the reason this code existed,
it looked like the Class=plugin was previously required on Docker Hub to handle
plugins, but this requirement is no longer there, so we can remove this special
handling.

This patch removes the special handling to both remove the use of the registry.Service
interface, as well as removing complexity that is no longer needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-23 13:44:48 +01:00
Sebastiaan van Stijn 14482589df
Merge pull request #4110 from thaJeztah/remove_ElectAuthServer
cli/command: remove deprecated ElectAuthServer()
2023-03-22 19:30:38 +01:00
Sebastiaan van Stijn a3d56e7d06
cli/command: remove deprecated ElectAuthServer()
This function was deprecated in b4ca1c7368,
which is part of the v23.0 release, and is no longer used, so we can remove it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-22 14:31:03 +01:00
Sebastiaan van Stijn bfe87fd39b
Merge pull request #4105 from thaJeztah/fix_comments
cli/command: ElectAuthServer: fix deprecation comment
2023-03-21 17:52:26 +01:00
Sebastiaan van Stijn 742881fc58
cli/command: fix imports formatting
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-21 16:55:34 +01:00
Sebastiaan van Stijn e3fa7280ad
cli/command: ElectAuthServer: fix deprecation comment
The comment was not formatted correctly, and because of that not picked up as
being deprecated.

updates b4ca1c7368

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-21 16:53:03 +01:00
Sebastiaan van Stijn 235b501b71
Merge pull request #4094 from crazy-max/plugins-completion
Add bash completion for available plugins
2023-03-21 16:45:08 +01:00
Sebastiaan van Stijn ac38a77ff9
Merge pull request #4104 from thaJeztah/volume_tests_discard
cli/command/volume: suppress err output in tests
2023-03-21 16:42:21 +01:00
Sebastiaan van Stijn 3c9e0073dd
Merge pull request #4099 from docker/dependabot/github_actions/actions/setup-go-4
build(deps): bump actions/setup-go from 3 to 4
2023-03-21 13:41:22 +01:00
Sebastiaan van Stijn db827d583b
cli/command/volume: suppress err output in tests
These tests were deliberately producing errors as part of the test, but
printing those errors could be confusing / make it more difficult to find
actual test-failures.

Before this patch:

    === RUN   TestVolumeCreateErrors
    Error: conflicting options: either specify --name or provide positional arg, not both
    Error: "create" requires at most 1 argument.
    See 'create --help'.

    Usage:  create [OPTIONS] [VOLUME] [flags]

    Create a volume
    Error: error creating volume
    --- PASS: TestVolumeCreateErrors (0.00s)
    PASS

With this patch applied:

    === RUN   TestVolumeCreateErrors
    --- PASS: TestVolumeCreateErrors (0.00s)
    PASS

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-21 13:21:20 +01:00
Sebastiaan van Stijn 166de0ec97
Merge pull request #4098 from thaJeztah/update_deps
update dependencies in preparation of updating engine
2023-03-21 13:05:16 +01:00
CrazyMax aa0aa4a6dc
Add bash completion for available plugins
Signed-off-by: CrazyMax <github@crazymax.dev>
2023-03-17 15:04:09 +01:00
dependabot[bot] 8805f8ea2d
build(deps): bump actions/setup-go from 3 to 4
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3 to 4.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-16 09:07:41 +00:00
Sebastiaan van Stijn e60c748c14
vendor: github.com/moby/buildkit v0.11.4
full diff: https://github.com/moby/buildkit/compare/v0.10.6..v0.11.4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-15 01:42:09 +01:00
Sebastiaan van Stijn 6c8cc226f0
vendor: google.golang.org/grpc v1.50.1
full diff: https://github.com/grpc/grpc-go/compare/v1.48.0...v1.50.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-15 01:42:09 +01:00
Sebastiaan van Stijn d213548bd0
vendor: golang.org/x/net v0.7.0
full diff: https://github.com/golang/net/compare/v0.5.0...v0.7.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-15 01:42:00 +01:00
Sebastiaan van Stijn 3a0d492d1c
vendor: golang.org/x/term v0.5.0
full diff: https://github.com/golang/term/compare/v0.4.0...v0.5.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-15 01:38:48 +01:00
Sebastiaan van Stijn f40bbf4f7f
vendor: golang.org/x/time v0.3.0
full diff: https://github.com/golang/time/compare/v0.1.0...v0.3.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-15 01:35:57 +01:00
Sebastiaan van Stijn a85537d346
vendor: golang.org/x/text v0.7.0
full diff: https://github.com/golang/text/compare/v0.6.0...v0.7.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-03-15 01:34:10 +01:00