Commit Graph

10188 Commits

Author SHA1 Message Date
David Karlsson bcd90be73a docs: fix link to http proxy document
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
(cherry picked from commit 78a8fba2cc)
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-08-11 16:46:02 +02:00
Sebastiaan van Stijn f62c68eedd
Merge pull request #5337 from vvoland/5327-27.x
[27.x backport] plugins: don't panic on Close if PluginServer nil
2024-08-09 20:03:37 +02:00
Jianyong Wu 946d1097b8
run: fix GetList return empty issue for throttledevice
Test "--device-read-bps" "--device-write-bps" will fail. The root
cause is that GetList helper return empty as its local variable
initialized to zero size.

This patch fix it by setting the related slice size to non-zero.

Signed-off-by: Jianyong Wu <wujianyong@hygon.cn>
Fixes: #5321
(cherry picked from commit 73e78a5822)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-08-09 19:47:08 +02:00
Sebastiaan van Stijn 096e42b366
Merge pull request #5335 from vvoland/5310-27.x
[27.x backport] gha: set permissions to read-only by default
2024-08-09 10:54:36 +02:00
Laura Brehm 984ef9072c
plugins: don't panic on Close if PluginServer nil
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
(cherry picked from commit 9c4480604e)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-08-09 10:48:40 +02:00
Sebastiaan van Stijn 30c7951192
Merge pull request #5334 from vvoland/5289-27.x
[27.x backport] docs: refresh image versions in examples
2024-08-09 10:48:38 +02:00
Sebastiaan van Stijn 54135b0724
gha: set permissions to read-only by default
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e4d99b4b60)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-08-09 10:44:34 +02:00
Sebastiaan van Stijn 40707e17b8
docs: refresh image versions in examples
use current LTS versions of ubuntu where suitable, remove uses of
ubuntu:23.10 (which reache EOL), and and update some other examples
to use more current versions.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b36522b473)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-08-09 10:42:40 +02:00
Sebastiaan van Stijn edd71d77c7
vendor: golang.org/x/sys v0.22.0
full diff: https://github.com/golang/sys/compare/v0.21.0...v0.22.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 501904d48f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-08-08 13:57:57 +02:00
Paweł Gronowski 9593373f9e
Merge pull request #5325 from vvoland/5324-27.x
[27.x backport] update to go1.21.13
2024-08-08 13:27:04 +02:00
Laura Brehm 5761e662f1
Merge pull request #5326 from vvoland/5303-27.x
[27.x backport] tests/run: fix flaky `RunAttachTermination` test
2024-08-07 12:31:40 +01:00
Laura Brehm c7f3031f74
tests/run: fix flaky `RunAttachTermination` test
This test was just incorrect (and testing incorrect
behavior): it was checking that `docker run` exited with a `context
canceled` error after signalling the CLI/cancelling the command's
context, but this was incorrect (and was fixed in
991b1303da - which was when this test
started failing).

However, since this test assertion was happening inside of a goroutine,
it would sometimes pass if this assertion didn't get to run before the
test suite terminated. It was flaky because sometimes this assertion
inside the goroutine did get to execute, but after the test finished
execution, which is a big no-no.

As an aside, assertions inside goroutines are generally bad, and `govet`
even has a linter for this (but it only catches `t.Fatal` and `t.FailNow`
calls and not `assert.Xx`.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
(cherry picked from commit eac83574c1)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-08-07 12:05:30 +02:00
Paweł Gronowski 53cb00a818
update to go1.21.13
- https://github.com/golang/go/issues?q=milestone%3AGo1.21.13+label%3ACherryPickApproved
- full diff: https://github.com/golang/go/compare/go1.21.12...go1.21.13

go1.21.13 (released 2024-08-06) includes fixes to the go command, the
covdata command, and the bytes package. See the [Go 1.21.13 milestone](https://github.com/golang/go/issues?q=milestone%3AGo1.21.13+label%3ACherryPickApproved)
on our issue tracker for details.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 434d8b75e8)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-08-07 11:50:29 +02:00
Paweł Gronowski a35c363ffc
Merge pull request #5302 from laurazard/27-attach-exit-code
[27.1 backport] attach: wait for exit code from `ContainerWait`
2024-07-26 17:21:35 +02:00
Laura Brehm 1cf3637198
attach: wait for exit code from `ContainerWait`
Such as with `docker run`, if a user CTRL-Cs while attached to a
container, we should forward the signal and wait for the exit from
`ContainerWait`, instead of just returning.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
(cherry picked from commit 7b46bfc5ac)
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2024-07-26 15:48:37 +01:00
Sebastiaan van Stijn fd3157bf35
Merge pull request #5296 from vvoland/5295-27.0
[27.1 backport] attach: don't return context cancelled error
2024-07-25 09:59:38 +02:00
Laura Brehm dfb8f2155a
attach: don't return context cancelled error
In 3f0d90a2a9 we introduced a global
signal handler and made sure all the contexts passed into command
execution get (appropriately) cancelled when we get a SIGINT.

Due to that change, and how we use this context during `docker attach`,
we started to return the context cancelation error when a user signals
the running `docker attach`.

Since this is the intended behavior, we shouldn't return an error, so
this commit adds checks to ignore this specific error in this case.

Also adds a regression test.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
(cherry picked from commit 66aa0f672c)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2024-07-25 09:51:11 +02:00
Sebastiaan van Stijn 2e506cbb10
Merge pull request #5293 from laurazard/27-backport-flaky-tests
[27.0 backport] tests: fix flaxy TestCloseRunningCommand test
2024-07-24 13:38:49 +02:00
Laura Brehm 7f02bc9704
tests: fix other flaky `connhelper` tests
Follow up to cc68c66c95 (there were more
tests with incorrect syntax).

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
(cherry picked from commit 4a7388f0dd)
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2024-07-24 12:19:22 +01:00
Laura Brehm 8a6f7d849d
tests: fix flaxy `TestCloseRunningCommand` test
Looks like this test was failing due to bad syntax on the `while` loop,
which caused it to die after 1 second. If the test took a bit longer,
the process would be dead before the following assertions run, causing
the test to fail/be flaky.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
(cherry picked from commit cc68c66c95)
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2024-07-24 12:19:04 +01:00
Paweł Gronowski 1b2782ef64
Merge pull request #5267 from thaJeztah/27.1_bump_engine
[27.1] vendor: github.com/docker/docker v27.1.1
2024-07-24 10:50:40 +02:00
Sebastiaan van Stijn a74040315e
vendor: github.com/docker/docker v27.1.1
no changes in vendored files

full diff: https://github.com/docker/docker/compare/v27.1.0...v27.1.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-24 00:23:56 +02:00
Sebastiaan van Stijn b889b2562c
vendor: github.com/docker/docker v27.1.0
full diff:

- https://github.com/docker/docker/compare/v27.0.3....v27.1.0
- google.golang.org/genproto/googleapis/rpc 49dd2c1f3d...995d672761
- google.golang.org/genproto/googleapis/api: 49dd2c1f3d...83a465c022

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-23 13:37:57 +02:00
Sebastiaan van Stijn b24c7417e4
vendor: github.com/containerd/containerd v1.7.20
no changes in vendored code

full diff: https://github.com/containerd/containerd/compare/v1.7.19...v1.7.20

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 401048b9cb)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-23 13:37:29 +02:00
Sebastiaan van Stijn 63125853e3
Merge pull request #5274 from thaJeztah/27.1_backport_compose_oom
[27.1 backport] Add OomScoreAdj to "docker service create" and "docker stack"
2024-07-19 19:35:01 +02:00
plaurent c599566439
Allow for OomScoreAdj
Signed-off-by: plaurent <patrick@saint-laurent.us>
(cherry picked from commit aa2c2cd906)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 19:06:39 +02:00
Sebastiaan van Stijn fb19def3ce
Merge pull request #5271 from thaJeztah/27.1_backport_custom_headers_env_var
[27.1 backport] add support for DOCKER_CUSTOM_HEADERS env-var (experimental)
2024-07-19 16:44:14 +02:00
Sebastiaan van Stijn bccd4786f7
Merge pull request #5270 from thaJeztah/27.1_backport_test_spring_cleaning
[27.1] test spring-cleaning
2024-07-19 15:09:56 +02:00
Sebastiaan van Stijn 8992378c87
add support for DOCKER_CUSTOM_HEADERS env-var (experimental)
This environment variable allows for setting additional headers
to be sent by the client. Headers set through this environment
variable are added to headers set through the config-file (through
the HttpHeaders field).

This environment variable can be used in situations where headers
must be set for a specific invocation of the CLI, but should not
be set by default, and therefore cannot be set in the config-file.

WARNING: If both config and environment-variable are set, the environment
variable currently overrides all headers set in the configuration file.
This behavior may change in a future update, as we are considering the
environment variable to be appending to existing headers (and to only
override headers with the same name).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 6638deb9d6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 15:07:06 +02:00
Sebastiaan van Stijn f90273c340
Merge pull request #5269 from thaJeztah/27.1_backport_add_macos_apple_silicon
[27.1 backport] gha: update to macOS 13, add macOS 14 arm64 (Apple Silicon M1)
2024-07-19 13:43:25 +02:00
Sebastiaan van Stijn ca9636a1c3
test spring-cleaning
This makes a quick pass through our tests;

Discard output/err
----------------------------------------------

Many tests were testing for error-conditions, but didn't discard output.
This produced a lot of noise when running the tests, and made it hard
to discover if there were actual failures, or if the output was expected.
For example:

    === RUN   TestConfigCreateErrors
    Error: "create" requires exactly 2 arguments.
    See 'create --help'.

    Usage:  create [OPTIONS] CONFIG file|- [flags]

    Create a config from a file or STDIN
    Error: "create" requires exactly 2 arguments.
    See 'create --help'.

    Usage:  create [OPTIONS] CONFIG file|- [flags]

    Create a config from a file or STDIN
    Error: error creating config
    --- PASS: TestConfigCreateErrors (0.00s)

And after discarding output:

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

Use sub-tests where possible
----------------------------------------------

Some tests were already set-up to use test-tables, and even had a usable
name (or in some cases "error" to check for). Change them to actual sub-
tests. Same test as above, but now with sub-tests and output discarded:

    === RUN   TestConfigCreateErrors
    === RUN   TestConfigCreateErrors/requires_exactly_2_arguments
    === RUN   TestConfigCreateErrors/requires_exactly_2_arguments#01
    === RUN   TestConfigCreateErrors/error_creating_config
    --- PASS: TestConfigCreateErrors (0.00s)
        --- PASS: TestConfigCreateErrors/requires_exactly_2_arguments (0.00s)
        --- PASS: TestConfigCreateErrors/requires_exactly_2_arguments#01 (0.00s)
        --- PASS: TestConfigCreateErrors/error_creating_config (0.00s)
    PASS

It's not perfect in all cases (in the above, there's duplicate "expected"
errors, but Go conveniently adds "#01" for the duplicate). There's probably
also various tests I missed that could still use the same changes applied;
we can improve these in follow-ups.

Set cmd.Args to prevent test-failures
----------------------------------------------

When running tests from my IDE, it compiles the tests before running,
then executes the compiled binary to run the tests. Cobra doesn't like
that, because in that situation `os.Args` is taken as argument for the
command that's executed. The command that's tested now sees the test-
flags as arguments (`-test.v -test.run ..`), which causes various tests
to fail ("Command XYZ does not accept arguments").

    # compile the tests:
    go test -c -o foo.test

    # execute the test:
    ./foo.test -test.v -test.run TestFoo
    === RUN   TestFoo
    Error: "foo" accepts no arguments.

The Cobra maintainers ran into the same situation, and for their own
use have added a special case to ignore `os.Args` in these cases;
https://github.com/spf13/cobra/blob/v1.8.1/command.go#L1078-L1083

    args := c.args

    // Workaround FAIL with "go test -v" or "cobra.test -test.v", see #155
    if c.args == nil && filepath.Base(os.Args[0]) != "cobra.test" {
        args = os.Args[1:]
    }

Unfortunately, that exception is too specific (only checks for `cobra.test`),
so doesn't automatically fix the issue for other test-binaries. They did
provide a `cmd.SetArgs()` utility for this purpose
https://github.com/spf13/cobra/blob/v1.8.1/command.go#L276-L280

    // SetArgs sets arguments for the command. It is set to os.Args[1:] by default, if desired, can be overridden
    // particularly useful when testing.
    func (c *Command) SetArgs(a []string) {
        c.args = a
    }

And the fix is to explicitly set the command's args to an empty slice to
prevent Cobra from falling back to using `os.Args[1:]` as arguments.

    cmd := newSomeThingCommand()
    cmd.SetArgs([]string{})

Some tests already take this issue into account, and I updated some tests
for this, but there's likely many other ones that can use the same treatment.

Perhaps the Cobra maintainers would accept a contribution to make their
condition less specific and to look for binaries ending with a `.test`
suffix (which is what compiled binaries usually are named as).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ab230240ad)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 13:37:27 +02:00
Sebastiaan van Stijn ad47d2a2c1
gha: update to macOS 13, add macOS 14 arm64 (Apple Silicon M1)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 9617e8d0ce)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 13:28:07 +02:00
Paweł Gronowski a2a0fb73ea
Merge pull request #5263 from thaJeztah/27.1_backport_relax_pr_check
[27.1 backport] gha: check-pr-branch: verify major version only
2024-07-19 13:25:57 +02:00
Sebastiaan van Stijn 16d6c90a94
Merge pull request #5265 from thaJeztah/27.1_backport_bump_buildx_compose
[27.0 backport] Dockerfile: update buildx to v0.16.1, compose to v2.29.0
2024-07-19 12:55:55 +02:00
Sebastiaan van Stijn f7be714467
gha: check-pr-branch: verify major version only
We'll be using release branches for minor version updates, so instead
of (e.g.) a 27.0 branch, we'll be using 27.x and continue using the
branch for minor version updates.

This patch changes the validation step to only compare against the
major version.

Co-authored-by: Cory Snider <corhere@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 6d8fcbb233)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 12:48:22 +02:00
Sebastiaan van Stijn 33bf62c4cb
Merge pull request #5261 from thaJeztah/27.1_backport_completion_enhancements
[27.0 backport] assorted fixes and enhancements for shell-completion
2024-07-19 12:05:33 +02:00
Sebastiaan van Stijn 7e972d2f5c
Merge pull request #5260 from thaJeztah/27.1_backport_fix-cli-login
[27.0 backport] fix: ctx cancellation on login prompt
2024-07-19 12:05:16 +02:00
Sebastiaan van Stijn a0791d0e8a
Merge pull request #5266 from thaJeztah/27.1_backport_update_dependencies
[27.0 backport] update dependencies for v27.1
2024-07-19 10:46:06 +02:00
Sebastiaan van Stijn 259d5e0f57
Dockerfile: update compose to v2.29.0
This is the version used in the dev-container, and for testing.

release notes: https://github.com/docker/compose/releases/tag/v2.29.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 77c0d83602)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 02:46:00 +02:00
Sebastiaan van Stijn c365c3cc8a
Dockerfile: update buildx to v0.16.1
This is the version used in the dev-container, and for testing.

release notes:
https://github.com/docker/buildx/releases/tag/v0.16.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit d00e1abf55)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 02:46:00 +02:00
Sebastiaan van Stijn 54c8eb7941
docs: fix typos and version for cli-docs-tool scripts
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 64a3fb82dc)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 02:04:44 +02:00
Sebastiaan van Stijn 5ab44a4690
vendor: github.com/docker/cli-docs-tool v0.8.0
no changes in vendored code

full diff: https://github.com/docker/cli-docs-tool/compare/v0.7.0...v0.8.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e3e9b99015)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 02:04:44 +02:00
Sebastiaan van Stijn 33e5c87957
vendor: google.golang.org/genproto/googleapis/api 49dd2c1f3d0b
No changes in vendored files. This one got out of sync with the other modules
from the same repository.

full diff: d307bd883b...49dd2c1f3d

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a77ba7eda8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 02:04:24 +02:00
Sebastiaan van Stijn 674f8d2979
vendor: github.com/prometheus/procfs v0.15.1
full diff: https://github.com/prometheus/procfs/compare/v0.12.0...v0.15.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit caa5d15e98)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 02:04:24 +02:00
Sebastiaan van Stijn 2794ebd599
vendor: github.com/containerd/containerd v1.7.19
no changes in vendored code

full diff: https://github.com/containerd/containerd/compare/v1.7.18...v1.7.19

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 0f712827f1)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 02:04:24 +02:00
Sebastiaan van Stijn 76863b46b7
vendor: golang.org/x/sync v0.7.0
no changes in vendored code

full diff: https://github.com/golang/sync/compare/v0.6.0...v0.7.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b28a1cd029)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 02:04:23 +02:00
Sebastiaan van Stijn e7bcae9053
vendor: golang.org/x/net v0.25.0
full diff: https://github.com/golang/net/compare/v0.24.0...v0.25.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a0c4e56dea)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 02:03:51 +02:00
Sebastiaan van Stijn 3577a17ce1
vendor: golang.org/x/crypto v0.23.0
no changes in vendored code

full diff: https://github.com/golang/crypto/compare/v0.22.0...v0.23.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 723130d7fe)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 02:03:51 +02:00
Sebastiaan van Stijn a8e2130643
vendor: golang.org/x/text v0.15.0
no changes in vendored files

full diff: https://github.com/golang/text/compare/v0.14.0...v0.15.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit d33ef57dcb)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 02:03:51 +02:00
Sebastiaan van Stijn 4f1a67e06b
vendor: golang.org/x/sys v0.21.0
full diff: https://github.com/golang/sys/compare/v0.19.0...v0.21.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 21dbedd419)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-19 02:03:51 +02:00