Commit Graph

4587 Commits

Author SHA1 Message Date
Laura Brehm 898e1b605d
signals/utils: always handle received signals
The changes in
dcbf005fe4
fixed the "cancellable context" detection, and made it so that Compose
would conditionally set up signal handling when the context was already
not cancellable/when the plugin was running through the CLI, as we'd
introduced a mechanism into the CLI to signal plugins to exit through a
socket instead of handling signals themselves.

This had some (not noticed at the time) issues when running through the
CLI as, due to sharing a process group id with the parent CLI process,
when a user CTRL-Cs the CLI will notify the plugin via the socket but
the plugin process itself will also be signalled if attached to the TTY.
This impacted some Compose commands that don't set up signal handling -
so not `compose up`, but other commands would immediately quit instead
of getting some "graceful" cancelled output.

We initially attempted to address this "double notification" issue in
the CLI by executing plugins under a new pgid so that they wouldn't be
signalled, but that posed an issue with Buildx reading from the TTY,
(see: https://github.com/moby/moby/issues/47073) so we reverted the
process group id changes and ended at a temporary solution in
https://github.com/docker/cli/pull/4792 where the CLI will only notify
plugins via the socket when they are not already going to be signalled
(when attached to a TTY).

Due to this, plugins should always set up some signal handling, which
this commit implements.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2024-01-17 17:18:20 +00:00
Nicolas De Loof f414bf7892 fix engine version require to use healthcheck.start_interval
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2024-01-17 10:45:01 +01:00
Nicolas De Loof 3c4593f2ad Stop the resource timer after last expected event
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2024-01-16 22:18:42 +01:00
dependabot[bot] d2562029f6
build(deps): bump github.com/containerd/containerd from 1.7.11 to 1.7.12 (#11347)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-16 15:13:12 -05:00
dependabot[bot] 26ed1051eb
build(deps): bump github.com/docker/docker from 25.0.0-rc.1+incompatible to 25.0.0-rc.2+incompatible (#11349)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-16 15:12:57 -05:00
dependabot[bot] 191c10b9d0
build(deps): bump github.com/docker/cli from 25.0.0-rc.1+incompatible to 25.0.0-rc.2+incompatible (#11348)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-16 15:12:35 -05:00
Guillaume Lours 8b16ab1040
Merge pull request #11307 from glours/compose-go-immutable-projects
update compose-go to version using immutable Project functions
2024-01-11 14:11:12 +01:00
Guillaume Lours 24d34040e3
Merge pull request #11181 from g0t4/11153-compose-attach-override-container-attach-cmd
Implement `docker compose attach`
2024-01-11 11:11:10 +01:00
Guillaume Lours dbe7819fd4
Merge pull request #11333 from milas/hack-user-agent
feat(cli): report more useful User-Agent on engine API requests
2024-01-11 10:57:14 +01:00
Guillaume Lours 5d05df6e5c update compose-go to version using immutable Project functions
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2024-01-11 10:44:42 +01:00
Milas Bowman b621948c1b feat(cli): report more useful User-Agent on engine API requests
When using the Moby/Docker Engine API client, we do not have a
useful user agent value being reported. Ideally, in the future,
the Docker CLI will set this appropriately for plugins when it
initializes the client.

For now, manually set it, which is a bit hacky because it
requires some casting & manually invoking an option function
that's technically meant for initialization. In practice, this
is pretty safe - the cast is checked defensively and we ignore
any errors (which shouldn't be possible anyway).

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2024-01-10 13:38:27 -05:00
Guillaume Lours 6f62bcccbb
Merge pull request #11332 from milas/bump-golangci-lint
ci(deps): bump golangci-lint to v1.55.2
2024-01-10 19:30:00 +01:00
Milas Bowman f5c53c2d07 ci(deps): bump golangci-lint to v1.55.2
No new violations / changes needed.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2024-01-10 12:56:48 -05:00
Guillaume Lours 1cfeda71eb
ci(deps): bump golang to version v1.21.6 (#11331)
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2024-01-10 12:18:43 -05:00
Guillaume Lours e9c7a3a9d5
Merge pull request #11324 from docker/dependabot/go_modules/golang.org/x/sys-0.16.0
build(deps): bump golang.org/x/sys from 0.15.0 to 0.16.0
2024-01-10 15:50:30 +01:00
Brian Goff 2bf2b22fbe Add source policies for build
Build{x,kit} support passing in source policies via an (expirimental)
env var.
This change adds those policies to the build request.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2024-01-10 11:41:03 +01:00
Guillaume Lours 8d81b87513
Merge pull request #11330 from ndeloof/watch_tar
watch: remove requirements for tar binary and for sync target to be rw
2024-01-09 16:58:38 +01:00
Nicolas De Loof 575f2ed7f2
watch: remove requirements for tar binary and for sync target to be rw
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2024-01-09 15:43:34 +01:00
Wes Higbee 5f4b22ed7c make docs
Signed-off-by: Wes Higbee <wes.mcclure@gmail.com>
2024-01-08 17:21:26 -06:00
Wes Higbee dcf6bd779f make mocks
Signed-off-by: Wes Higbee <wes.mcclure@gmail.com>
2024-01-08 17:15:11 -06:00
Wes Higbee 80823b77ef go ahead and wire up sig-proxy and no-stdin for consistency with underlying docker container attach
Signed-off-by: Wes Higbee <wes.mcclure@gmail.com>
2024-01-08 17:15:11 -06:00
Wes Higbee 2c16e16db7 docker compose attach via RunAttach (from docker/cli's docker container attach)
Signed-off-by: Wes Higbee <wes.mcclure@gmail.com>
2024-01-08 17:14:49 -06:00
dependabot[bot] d1be9caf59
build(deps): bump golang.org/x/sys from 0.15.0 to 0.16.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.15.0 to 0.16.0.
- [Commits](https://github.com/golang/sys/compare/v0.15.0...v0.16.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-08 09:34:40 +00:00
Guillaume Lours f659918743
Merge pull request #11298 from ndeloof/proxy
remove ServiceProxy which was introduced for archived compose-cli
2024-01-08 10:04:00 +01:00
dependabot[bot] c3c0cf3d94
build(deps): bump golang.org/x/sync from 0.5.0 to 0.6.0 (#11317)
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.5.0 to 0.6.0.
- [Commits](https://github.com/golang/sync/compare/v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-05 13:43:38 -05:00
Milas Bowman eec822de8f
Merge pull request #11321 from thaJeztah/gha_bump_cli_version
gha: update DOCKER_CLI_VERSION to v24.0.7
2024-01-05 13:42:29 -05:00
Milas Bowman 6df3886b44
Merge pull request #11320 from thaJeztah/bump_engine3
go.mod: update docker/docker and docker/cli to v25.0.0-rc.1
2024-01-05 13:41:33 -05:00
Sebastiaan van Stijn 279874158c
gha: update DOCKER_CLI_VERSION to v24.0.7
I noticed that the CLI was still on 20.10, but the daemon on 24.0.7;

    Docker info
    /usr/bin/docker version
    Client:
    Version:           20.10.17
    API version:       1.41
    Go version:        go1.17.11
    Git commit:        100c701
    Built:             Mon Jun  6 22:56:42 2022
    OS/Arch:           linux/amd64
    Context:           default
    Experimental:      true
    Server: Docker Engine - Community
    Engine:
    Version:          24.0.7
    API version:      1.43 (minimum version 1.12)
    Go version:       go1.20.10
    Git commit:       311b9ff
    Built:            Thu Oct 26 09:07:41 2023
    OS/Arch:          linux/amd64
    Experimental:     false
    containerd:
    Version:          1.6.26
    GitCommit:        3dd1e886e55dd695541fdcd67420c2888645a495
    runc:
    Version:          1.1.10
    GitCommit:        v1.1.10-0-g18a0cb0
    docker-init:
    Version:          0.19.0
    GitCommit:        de40ad0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-01-05 19:32:23 +01:00
Sebastiaan van Stijn 566d2207f3
go.mod: github.com/docker/cli v25.0.0-rc.1
full diff: https://github.com/docker/cli/compare/v25.0.0-beta.3...v25.0.0-rc.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-01-05 18:57:57 +01:00
Sebastiaan van Stijn d09c39dced
go.mod: github.com/docker/docker v25.0.0-rc.1
full diff: https://github.com/docker/docker/compare/v25.0.0-beta.3...v25.0.0-rc.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-01-05 18:57:15 +01:00
Sebastiaan van Stijn a1d36379a3
go.mod: github.com/klauspost/compress v1.17.4
full diff: https://github.com/klauspost/compress/compare/v1.17.2...v1.17.4

v1.17.4:

- huff0: Speed up symbol counting
- huff0: Remove byteReader
- gzhttp: Allow overriding decompression on transport
- gzhttp: Clamp compression level
- gzip: Error out if reserved bits are set

v1.17.3:

- fse: Fix max header size
- zstd: Improve better/best compression
- gzhttp: Fix missing content type on Close

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-01-05 18:45:31 +01:00
Sebastiaan van Stijn 0c55998b41
go.mod: github.com/felixge/httpsnoop v1.0.4
full diff: https://github.com/felixge/httpsnoop/compare/v1.0.3...v1.0.4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-01-05 18:39:58 +01:00
Sebastiaan van Stijn 2f6ec9b777
go.mod: github.com/docker/go-connections v0.5.0
no diff, as the tag is the same commit as we used already;
https://github.com/docker/go-connections/compare/fa09c952e3ea...v0.5.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-01-05 18:33:26 +01:00
Milas Bowman 06af729dc8
Merge pull request #11292 from laurazard/update-cli-signal-handling
Up: teardown when command context is cancelled
2024-01-02 15:48:14 -05:00
Laura Brehm dcbf005fe4
up: gracefully teardown when command ctx cancelled
Previously, if a long-lived plugin process (such as
an execution of `compose up`) was running and then
detached from a terminal, signalling the parent CLI
process to exit would leave the plugin process behind.

To address this, changes were introduced on the CLI side
(see: https://github.com/docker/cli/pull/4599) to enable
the CLI to notify a running plugin process that it should
exit. This makes it so that, when the parent CLI process
is going to exit, the command context of the plugin
command being executed is cancelled.

This commit takes advantage of these changes by tapping into
the command context's done channel and using it to teardown
on an up.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-12-23 02:49:27 +00:00
Nicolas De Loof e105f16527 introduce `stats` command
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-12-22 16:03:02 +01:00
Laura Brehm ce5a0c656f
Fix cancellable context detection in `AdaptCmd`
`AdaptCmd` was previously checking for a `.WithCancel` suffix
on context strings, however it's possible for a context to be
cancellable without ending in that suffix, such as when
`context.WithValue` was called after `WithContext`, e.g.:

```go
context.Background.WithCancel.WithValue(type trace.traceContextKeyType,
val <not Stringer>).WithValue(type api.DryRunKey, val <not Stringer>)
```

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-12-22 13:39:04 +00:00
Nicolas De Loof f58f23a6a2
remove ServiceProxy which was introduced for archived compose-cli
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-12-22 14:02:21 +01:00
Guillaume Lours d82a1a5a03
Merge pull request #11294 from thaJeztah/bump_engine2
go.mod: docker/docker and docker/cli v25.0.0-beta.3
2023-12-22 11:28:37 +01:00
Sebastiaan van Stijn 9aa5232601 go.mod: docker/docker and docker/cli v25.0.0-beta.3
- https://github.com/docker/cli/compare/70216b662dc4...v25.0.0-beta.3
- https://github.com/docker/docker/compare/v25.0.0-beta.2...v25.0.0-beta.3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-12-22 11:18:43 +01:00
Sebastiaan van Stijn ccd83b8a74 go.mod: github.com/gorilla/mux v1.8.1
full diff: https://github.com/gorilla/mux/compoare/v1.8.0...v1.8.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-12-22 11:18:43 +01:00
Sebastiaan van Stijn 9e57850c16 go.mod: github.com/docker/distribution v2.8.3
full diff: https://github.com/docker/distribution/compare/v2.8.2...v2.8.3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-12-22 11:18:43 +01:00
Sebastiaan van Stijn 35d3a7ca56 go.mod: golang.org/x/crypto v0.17.0
update the package, which contains a fix in the ssh package.

full diff: https://github.com/golang/crypto/compare/v0.16.0...v0.17.0

from the security mailing:

> Hello gophers,
>
> Version v0.17.0 of golang.org/x/crypto fixes a protocol weakness in the
> golang.org/x/crypto/ssh package that allowed a MITM attacker to compromise
> the integrity of the secure channel before it was established, allowing
> them to prevent transmission of a number of messages immediately after
> the secure channel was established without either side being aware.
>
> The impact of this attack is relatively limited, as it does not compromise
> confidentiality of the channel. Notably this attack would allow an attacker
> to prevent the transmission of the SSH2_MSG_EXT_INFO message, disabling a
> handful of newer security features.
>
> This protocol weakness was also fixed in OpenSSH 9.6.
>
> Thanks to Fabian Bäumer, Marcus Brinkmann, and Jörg Schwenk from Ruhr
> University Bochum for reporting this issue.
>
> This is CVE-2023-48795 and Go issue https://go.dev/issue/64784.
>
> Cheers,
> Roland on behalf of the Go team

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-12-22 11:18:43 +01:00
Sebastiaan van Stijn 6c998602bb go.mod: golang.org/x/crypto v0.16.0
full diff: https://github.com/golang/crypto/compare/v0.14.0...v0.16.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-12-22 11:18:43 +01:00
Sebastiaan van Stijn 402f368830 go.mod: golang.org/x/text v0.14.0
full diff: https://github.com/golang/text/compare/v0.13.0...v0.14.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-12-22 11:18:43 +01:00
Sebastiaan van Stijn 30dd3e66d7 go.mod: golang.org/x/term v0.15.0
full diff: https://github.com/golang/term/compare/v0.13.0...v0.15.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-12-22 11:18:43 +01:00
Nicolas De Loof 0c4fa017b9 Bump compose-go v2-beta.2
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-12-22 11:16:13 +01:00
dependabot[bot] b12e23b0bd build(deps): bump go.uber.org/mock from 0.3.0 to 0.4.0
Bumps [go.uber.org/mock](https://github.com/uber/mock) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/uber/mock/releases)
- [Changelog](https://github.com/uber-go/mock/blob/main/CHANGELOG.md)
- [Commits](https://github.com/uber/mock/compare/v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: go.uber.org/mock
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-21 14:52:59 +01:00
Nicolas De Loof 17da54da20 introduce build --with-dependencies
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-12-20 15:58:54 +01:00
horus 1baa4f4489 up: fix write/close race condition in logPrinter
The code used an atomic bool to guard channel writes. However, this
failed to synchronize with the call to close(), causing a panic.

Fix the race condition by using a mutex to guard the update to the
bool `stopped` and subsequent channel writes. This ensures atomic
execution of both updates to `stopped` and channel writes, preventing
races between writes and close().

Signed-off-by: horus <horus.li@gmail.com>
2023-12-20 15:45:12 +01:00