Commit Graph

714 Commits

Author SHA1 Message Date
Guillaume Lours 25be264ed8 support dry-run for exec command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-02-08 11:21:47 +01:00
Guillaume Lours 70ab9f8f33 bump docker engine and cli version to 23.0.0 with buildkit(v0.11.2) and buildx (v0.10.2)
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-02-08 10:11:50 +01:00
Nicolas De Loof 93bffd9a7f
prevent assignment to entry in nil map
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-07 20:50:15 +01:00
Nicolas De Loof 52478f0c6e wait on service containers as dependencies to be deterministic
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-07 16:36:45 +01:00
Nicolas De Loof b5f0a4eefa use containers we expect to start for wait condition
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-07 16:36:45 +01:00
Nicolas De Loof 0f5b5ccbd0 detect replacement container is created and inform printer so it attach and don't stop
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-06 11:23:13 +01:00
Guillaume Lours fdc1738143 add log when copying files/directories between host and containers (both way)
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-02-03 22:44:26 +01:00
Guillaume Lours 2336d9fe35 support dry-run for cp command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-02-03 22:44:26 +01:00
Milas Bowman bf0ed9a4d4
Merge pull request #10226 from benmoss/add-remote-builder
Add remote buildx driver
2023-02-03 15:03:49 -05:00
Nicolas De Loof 1640f155e9 initial support for `sync`
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-02 14:59:30 +01:00
Nicolas De Loof e63cbfba0e use tilt watcher to track filesystem changes
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-02 14:59:30 +01:00
Nicolas De Loof 25576289c8 adjust code and dependencies
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-02 14:59:30 +01:00
Nick Santos 7d6ee74e62 cleanup deprecated ioutil functions (#5919)
Signed-off-by: Nick Santos <nick.santos@docker.com>

Signed-off-by: Nick Santos <nick.santos@docker.com>
2023-02-02 14:59:30 +01:00
Nick Santos c08e07714a watch: optimization to help avoid inotify nodes for large file trees (#5769)
fixes https://github.com/tilt-dev/tilt/issues/5764
2023-02-02 14:59:30 +01:00
Matt Landis cf31462398 tests: make test fixtures responsible for tearing themselves down (#5512) 2023-02-02 14:59:30 +01:00
Ken Sipe 1b71e3efb3 lint: fix local-prefixes for goimports (#5453)
Fix local-prefixes on linters imports then resolved imports to be as expected

Signed-off-by: Ken Sipe <kensipe@gmail.com>
2023-02-02 14:59:30 +01:00
Milas Bowman 4d822676ce ci: add exportloopref linter and upgrade to golangci-lint v1.43.0 (#5281)
`exportloopref` - detects captures of loop variable without
re-assignment

NOTE: There can be false negatives with this linter to avoid being
            overly strict and annoying!

Also upgraded `golangci-lint` to latest (v1.43.0 published 2021-11-03).
2023-02-02 14:59:30 +01:00
Milas Bowman 6fc0b6ff27 build: ensure file handles properly closed (#5298)
I've been running the test suite (`./internal/engine` in particular)
with `-count X` a lot recently to catch timing-related test failures.

After running enough times, the tests start failing due to too many
open files, so I did an audit and found a few places where files or
readers weren't always being closed.
2023-02-02 14:59:30 +01:00
Nick Sieger ab84b6ac5b Fix local go_lintfix errors (#5191)
* lint: add make lintfix and run it

Fixes all errors like:
```
File is not `goimports`-ed with -local github.com/tilt-dev/tilt (goimports)
```

* git: change to use TrimSuffix

* build: remove unnecessary cast
2023-02-02 14:59:30 +01:00
Milas Bowman 7161778ccf watch: use WalkDir to speed up file listing (#4684)
`WalkDir` is new in Go 1.16 and avoids calling `os.Lstat` on
every visited file and directory. In most cases, we don't need
that info, so this will help reduce I/O when listing files,
which can be helpful for particularly big monorepos.
2023-02-02 14:59:30 +01:00
Nick Santos 1f5bfe8882 test: clean up test loggers a bit (#4580) 2023-02-02 14:59:30 +01:00
Milas Bowman f79c75ab10 test: fix lint errors on Darwin (macOS) (#4247)
Unused code linter isn't particularly smart about platform build
tags, so since this func is only used by the "naive" (non-macOS)
file watcher, it needs to live with that or it gets flagged as
dead code when linting on macOS.
2023-02-02 14:59:30 +01:00
Nick Santos e62993a854 test: enable unused check, remove dead code (#4208) 2023-02-02 14:59:30 +01:00
Nick Santos 28251e8be5 watch: improve error messages when you run out of inotify instances (#3960) 2023-02-02 14:59:30 +01:00
Nick Santos c7ba7d9de5 dockerignore: convert ignore patterns to absolute paths [ch9237] (#3743)
In most places in Tilt, we try to use absolute paths everywhere.
So this makes things more consistent with the rest of Tilt, and lets us be
a bit more flexible in how we handle subdirs and parent dirs in ignores.

Fixes https://github.com/tilt-dev/tilt/issues/3740
2023-02-02 14:59:30 +01:00
Nick Santos 8b39322365 watch: fix a dumb errcheck (#3622) 2023-02-02 14:59:30 +01:00
Nick Santos b3615d64e2 watch: increase the windows watch i/o buffer (#3620)
fixes https://github.com/tilt-dev/tilt/issues/3556
2023-02-02 14:59:30 +01:00
Nick Santos 1a1d1707ed change org name from windmilleng to tilt-dev (#3346) 2023-02-02 14:59:30 +01:00
Nick Santos fd3e0bbe2b watch: use the recursive watcher on windows (#3306) 2023-02-02 14:59:30 +01:00
Nick Santos d2d4d05264 Revert "watch: fix inotify tests on windows" (#3147)
This reverts commit 74ac7997b1c8f497babbbd499ff1f047563d699a.
2023-02-02 14:59:30 +01:00
Nick Santos dda0362b6e watch: fix inotify tests on windows (#3140) 2023-02-02 14:59:30 +01:00
Nick Santos ddc88ec41b circleci: run make shorttest on windows. flag off a large swath of broken tests (#3132) 2023-02-02 14:59:30 +01:00
Matt Landis 92c6a65a03 tilt: enable errcheck on tests (#2877) 2023-02-02 14:59:30 +01:00
Dan Miller 00b3caecbb ci: enable staticcheck, fix problems that were surfaced (#2809) 2023-02-02 14:59:30 +01:00
Dan Miller 17087447e9 logger: move to pkg (#2031) 2023-02-02 14:59:30 +01:00
Nick Santos ec781687fd watch: add retry counts to fsync (#2023) 2023-02-02 14:59:30 +01:00
Nick Santos b22dde9f18 dockerignore: improve MatchesEntireDir (#1865) 2023-02-02 14:59:30 +01:00
Nick Santos a31350ede1 watch: move more of the directory-skipping logic into the interface (#1864) 2023-02-02 14:59:30 +01:00
Nick Santos d744c97f13 watch: add a simple check when there are no exclusions (#1863) 2023-02-02 14:59:30 +01:00
Nick Santos 37647bc600 watch: skip setup if nothing is being watched (#1861) 2023-02-02 14:59:30 +01:00
Nick Santos 21e5d564af watch: FileEvents must always be absolute (#1841)
there were a lot of confused tests that were using relative paths, then trying to workaround this
2023-02-02 14:59:30 +01:00
Nick Santos 390d5cf165 watch: add tests for ignores and number of watches (#1838) 2023-02-02 14:59:30 +01:00
Nick Santos 7f6e189dbc watch: change the watcher interface to better match how we actually use it (#1835) 2023-02-02 14:59:30 +01:00
Dan Miller b5ccea7b0e watch: record num watches in expvars (#1795) 2023-02-02 14:59:30 +01:00
Matt Landis 47551895f3 makefile: fix goimports -local (#1763) 2023-02-02 14:59:30 +01:00
Nick Santos 5e0f1eec16 watch: fix spurious errors while watching (#1726) 2023-02-02 14:59:30 +01:00
Dan Bentley f82e2de57e watch: don't watch each individual file (#1613) 2023-02-02 14:59:30 +01:00
Matt Landis 9c7f7bc0fa live_update: error if syncing from outside of docker context (#1396) 2023-02-02 14:59:30 +01:00
Nick Santos 6defe7cac6 watch: tfw you have a test that asserts broken file-watch behavior 😢 (#1354) 2023-02-02 14:59:30 +01:00
Dan Miller 0482f9276a watch: add watch function that traverses up directory structure recursively (#1013) 2023-02-02 14:59:30 +01:00
Nick Santos e8a34c8d1e watch: remove inotify-specific bits of watcher_linux (#890)
the tests on windows don't pass yet, but at least it compiles
2023-02-02 14:59:30 +01:00
Nick Santos 9e261c18b3 watch: fix a bug when a file and its ancestor both have direct watches (#863) 2023-02-02 14:59:30 +01:00
Nick Santos 1fd7ca5440 testing: update internal/watch to use the tempdir fixture (#862) 2023-02-02 14:59:30 +01:00
Maia McCormick 139edc403f cleanup: wrap errors properly (#772)
* cleanup: wrap errors properly

* fix build error

* asdfg linux

* fix test
2023-02-02 14:59:30 +01:00
Dan Miller 38b3f3b678 watch: use `sinceWhen` and `HistoryDone` to avoid spurious events (#557)
Here's our new watch strategy on Darwin in a nutshell:

1. Create an fsevents stream for events "since" the last event ID that
we saw globally.
2. Add a path that we want to watch
3. Add that path to a map of paths that we're watching _directly_.
4. Restart the event stream to pick up the new path.
5. Ignore all events for all watches until we've seen a `HistoryDone`
event.
6. Ignore the first `ItemCreated` event for paths we're watching that
are also directories
7. Otherwise, forward along all events.
2023-02-02 14:59:30 +01:00
Nick Santos c5bce8bd42 watch: fix a spurious error (#344) 2023-02-02 14:59:30 +01:00
Nick Santos c8a358a455 watch: try a slightly different ignore strategy (#174) 2023-02-02 14:59:30 +01:00
Nick Santos a6701652d2 watch: fix more data races on darwin (#166) 2023-02-02 14:59:30 +01:00
Nick Santos 4562b0bf95 watch: a new strategy for handling spurious events, hoping to fix race conditions (#163) 2023-02-02 14:59:30 +01:00
Nick Santos 4801d2b1a4 watch: fix a flaky test by ignoring spurious events correctly (#162) 2023-02-02 14:59:30 +01:00
Nick Santos 3850a34114 watch: fix a segfault on linux (#148) 2023-02-02 14:59:30 +01:00
Nick Santos 664e6f6f23 watch: stop skipping tests (#145) 2023-02-02 14:59:30 +01:00
Nick Santos d4f074b32f watch: simplify the fileEvent interface to only contain paths (#144) 2023-02-02 14:59:30 +01:00
Dan Miller a3b012d89f add errcheck (#93) 2023-02-02 14:59:30 +01:00
Matt Landis a755c84ea0 tilt: copy watch code from tesseract 2023-02-02 14:59:30 +01:00
Ben Moss ef34a38ac0
Add remote buildx driver
Signed-off-by: Ben Moss <ben@mossity.com>
2023-02-01 10:30:07 -05:00
Guillaume Lours f24d3458c6
Merge pull request #10217 from glours/dry-run-pause-support
Dry run pause support
2023-01-31 14:56:27 +01:00
Nicolas De Loof 41e056341b rename `convert` to `config` to align with compose v1 UX
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-30 22:23:53 +01:00
Guillaume Lours 6754c6b68a add dry-run support of pause and unpause commands
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-30 10:36:36 +01:00
Guillaume Lours 982a8ccb88 support dry-run for kill command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-30 09:27:17 +01:00
Guillaume Lours 790712fa92 update tty and plain text writers to support dry run mode
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-30 09:27:17 +01:00
maxcleme 634a7d2a7b Support for docker compose build --push when using multiple platforms
Signed-off-by: maxcleme <maxime.clement@docker.com>
2023-01-26 16:54:41 +01:00
Nicolas De Loof aa31387355 cleanup TUI lines after switching to "compact" mode
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-26 07:56:49 +01:00
Guillaume Lours d5d9f67547
Merge pull request #10173 from glours/dry-run
Skeleton for dry-run under alpha command
2023-01-20 15:37:52 +01:00
Laura Brehm 220626ec5e
Only account running containers for logs
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-01-20 13:30:05 +01:00
Nicolas De Loof c15bf1955a debounce refresh requests with quietperiod
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-18 22:12:54 +01:00
Laura Brehm 0b1c86726e Add tests for filtering containers not created by Compose
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-01-17 19:00:02 +01:00
Laura Brehm 82ef998511 Ignore containers created outside compose
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-01-17 19:00:02 +01:00
Guillaume Lours fb36f7fffd directly embed the orignal APIClient in the DryRunClient
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-16 11:11:35 +01:00
Guillaume Lours 3fac506a30 identify functions which need to be ovorridden for dry run feature
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-16 11:11:35 +01:00
Guillaume Lours eb59b0e265 add alpha command to test dry-run
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-16 11:11:35 +01:00
Guillaume Lours 5081ab0507 create custom CLI when dry-run mode active
update documentation

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-16 11:11:35 +01:00
Guillaume Lours 13ef440d6a add DryRun API Client with delagation pattern
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-16 11:11:35 +01:00
Guillaume Lours fbf845c5f8 add dry-run flag
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-16 11:11:35 +01:00
Guillaume Lours 5a2b7b83cd use compose service methods when exist instead of directly service.dockerCli
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-13 21:02:00 +01:00
Laura Brehm 9daf41892f
Adjust terminal height calc
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-01-12 11:20:05 +01:00
Laura Brehm 2aa88b5c9e
Merge pull request #10149 from TColl/typo-fix
fix typo
2023-01-12 10:56:28 +01:00
Nicolas De Loof bb9cf32245 introduce experimental watch command (skeletton)
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-12 10:52:58 +01:00
Laura Brehm 69a09624c9 Skip child events when printer events > terminal height
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-01-12 09:52:25 +01:00
Tom Collingwood f2088bb917 fix typo
Signed-off-by: Tom Collingwood <tomcollingwood@yahoo.co.uk>
2023-01-11 19:07:29 +00:00
Nicolas De Loof 3e12a7cb23 pass proxy config as build args - same as docker/buildx#959
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-10 12:15:13 +01:00
Edward Muller 73ebbffb08 Don't share the options map
Without this I get an exception when building multiple images in a
compose run.

```
fatal error: concurrent map writes

goroutine 16 [running]:
github.com/docker/compose/v2/pkg/compose.(*composeService).build.func1({0x2cba4e0, 0xc00019b2c0}, {0xc000233150?, 0xd?})
        github.com/docker/compose/v2/pkg/compose/build.go:95 +0x652
github.com/docker/compose/v2/pkg/compose.(*graphTraversal).run.func1()
        github.com/docker/compose/v2/pkg/compose/dependencies.go:127 +0x63
golang.org/x/sync/errgroup.(*Group).Go.func1()
        golang.org/x/sync@v0.1.0/errgroup/errgroup.go:75 +0x64
created by golang.org/x/sync/errgroup.(*Group).Go
        golang.org/x/sync@v0.1.0/errgroup/errgroup.go:72 +0xa5
...
```

I'm not sure why the map is currently shared, but with this patch
applied my docker-compose build run works.

Signed-off-by: Edward Muller <emuller@fastly.com>
2023-01-09 12:01:57 +01:00
Nicolas De Loof b326a9da1d
don't filter by services if no filter was set
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-09 11:49:08 +01:00
Nicolas De Loof f1313f3a09 use a simpler prompt implementation when we lack a terminal
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-09 10:28:16 +01:00
Nicolas De Loof 96bbda98f8 add support for uts namespace
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-06 08:15:52 +01:00
Guillaume Lours f6f29a4438
Merge pull request #10133 from ndeloof/build_concurrency
limit build concurrency according to --parallel
2023-01-05 09:57:13 +01:00
Nicolas De Loof d5e4f00644 introduce --no-attach to ignore some service output
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-03 18:43:40 +01:00
Nicolas De Loof 8b4ac37f9c introduce `--ignore-buildable` to ignore buildable images on pull
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-03 18:43:23 +01:00
Nicolas De Loof b96e27e0e7 limit build concurrency according to --parallel
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-03 12:01:30 +01:00
Guillaume Tardif 37d15d7e6b Ignore not only auto-removed containers but also "removal in progress" for orphan containers
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2023-01-03 11:09:41 +01:00
Guillaume Lours fd353ffa94 add support of privileged attribut in service.build section
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-12-23 09:32:48 +01:00
Guillaume Lours adf8e75317 cleanup framework.go from uncessary debug logs
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-12-21 21:28:06 +01:00
Guillaume Lours 6c537cc0f4
Merge pull request #10113 from glours/add-buildx-plugin-e2e
add buildx plugin to e2e configuration directory
2022-12-21 21:21:01 +01:00
Nicolas De Loof 9f7ad18d62 reduce cyclomatic complexity
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-21 21:12:06 +01:00
Nicolas De Loof 40ebcd6203 fix security opts support (seccomp and unconfined)
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-21 21:12:06 +01:00
Nicolas De Loof 9bd9f1765c check service names based on project, not running containers
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-21 21:11:44 +01:00
Guillaume Lours 5dcadc05d9
debut output for CI
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-12-21 21:09:49 +01:00
Guillaume Lours c72f161afb
change the way finding the just built compose binary
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-12-21 19:47:39 +01:00
Guillaume Lours 86a648bd51
e2e tests display Compose version used to run the test
currently the version displayed is the one installed and not the one use for the tests

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-12-21 18:38:24 +01:00
Guillaume Lours 935968fe2c
add buildx plugin to e2e configuration directory
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-12-21 15:27:34 +01:00
Nicolas De Loof 91371fef7a remove flaky TestLocalComposeLogsFollow
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-21 08:45:41 +01:00
Nicolas De Loof 986bc44549 service hash MUST exclude replicas
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-21 08:45:41 +01:00
Nicolas De Loof 24f83271f2 don't assume os.Stdout and rely on dockerCLI.streams
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-20 23:52:25 +01:00
Nicolas De Loof dacf24374d
dump stdout to help diagnose flaky test
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-20 23:50:58 +01:00
Nicolas De Loof 22d2e83896
don't fail `logs` when driver:none is set
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-20 16:23:47 +01:00
Nicolas De Loof b4b7319901
introduce support for cgroup namespace
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-20 14:06:33 +01:00
Nicolas De Loof 0ab5079c1a
fix race condition on compose logs
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-20 09:21:31 +01:00
Nicolas De Loof b8bbdcd872 detect dependency failed to start
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-19 16:26:39 +01:00
Nicolas De Loof d0e95ccac3
set CPU quota
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-19 15:05:09 +01:00
Guillaume Lours 1e682a40ac
Merge pull request #10099 from laurazard/use-defaultplatform-create
Use `DOCKER_DEFAULT_PLATFORM` to determine platform when creating container
2022-12-19 14:17:49 +01:00
Laura Brehm 7bc27d441b
Use `DOCKER_DEFAULT_PLATFORM` to determine platform when creating container
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-12-19 11:58:03 +00:00
Nicolas De Loof c1ce53c972 fix regression running pull --ignore-pull-failures
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-19 11:56:03 +01:00
Nicolas De Loof e42673daed only list running containers when --all=false
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-16 21:46:55 +01:00
Milas Bowman ffb95449a2 volume: fix WCOW volume mounts
Do not use the older `Volumes` field in the API; instead rely on
the more robust `Mounts`. For Linux containers, it seems that it's
fine to set both of these. For Windows containers (WCOW), however,
there appears to be a Moby bug that causes it to normalize the
anonymous (`Volumes`) variant to lowercase, which can result in
duplicative volume definitions and an error when trying to start
the container.

Fixes #9577.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-12-16 09:52:34 -05:00
Nicolas De Loof 5c1484ece6 apply uid/gid when creating secret from environment
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-15 15:54:04 +01:00
Nicolas De Loof 8c39b5b7fd align `--format` flag and UX with docker cli
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-14 22:53:43 +01:00
Nicolas De Loof bc568eeb9b align `compose ps` output with `docker ps`
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-14 22:53:43 +01:00
Sebastiaan van Stijn a501ab3a2f use StatusError from docker/cli, not "dockerd"
This package is a leftover from when the "docker" cli and the "dockerd"
cli both lived in the same repository. The package in docker/docker will
be (re)moved soon, so replace it with the implementation in docker/cli,
which is the right one :)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-14 22:53:18 +01:00
Nicolas De Loof 05e987dd0a fix parsing of repository:tag
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-14 09:23:07 +01:00
Nicolas De Loof 0368f19030 distinguish stdout and stderr in `up` logs
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-13 14:42:42 +01:00
Nicolas De Loof 3ee2ab87bb ContainerStart must run sequentially for engine to assing distinct ports within configured range
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-12 16:08:50 +01:00
Nicolas De Loof 8f991a20db Fix corner case when there's no container to attach to
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-09 10:02:56 +01:00
Nicolas De Loof 0234e13454 Don't stop pull for images that can be built
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-08 21:20:04 +01:00
Nicolas De Loof a73dce44b3 fix race condition collecting pulled images IDs
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-07 21:33:44 +01:00
Nicolas De Loof 804d7163a7 detect required service are gone to stop watching
explicit API to stop the log printer

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-07 21:07:27 +01:00
Sebastiaan van Stijn 87a0a57f70 Cleanup tips from output
The scan tip has been shown for two years, and most users will know
about it by now. Presenting the message also involved checking if the
plugin was installed, and wether or not the message was shown before,
which also caused some overhead, so cleaning up the output a bit.

The corresponding DOCKER_SCAN_SUGGEST environment-variable is also
removed with this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-06 23:29:03 +01:00
Guillaume Lours 95bc6c58b7
check only running containers in after down tests of profiles e2e tests
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-12-06 23:17:14 +01:00
Nicolas De Loof a0acc20d88
introduce --parallel to limit concurrent engine calls
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-06 08:15:50 +01:00
Milas Bowman 053f20edab
port: improve error-handling if port not found (#10039)
This method looked slightly incomplete. If the port wasn't found,
it'd return `err`, but that was always `nil`, so we'd print out
`:0`.

Now, we construct a nice error message with the targeted port and
the ones we found.

The `--protocol` flag is also now case-insensitive to prevent any
weirdness/confusion there.

Co-authored-by: Nick Sieger <nicksieger@gmail.com>
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-12-05 22:11:45 +00:00
Milas Bowman 113fb6732d
schema: add support for tmpfs.mode in mount definition (#10031)
See compose-spec/compose-go#325 for the acutal spec change. This
propagates it to the Engine API object and adds an E2E test via
Cucumber 🥒

Fixes #9873.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-12-02 11:21:53 -05:00
i-ky c74a77e895 Make use of Containers.filter() and isService()
Signed-off-by: i-ky <gl.ivanovsky@gmail.com>
2022-12-02 12:16:35 +01:00
i-ky 7f975fa40b Fix replacing "service:x" with "container:y"
Signed-off-by: i-ky <gl.ivanovsky@gmail.com>
2022-12-02 12:16:35 +01:00
Nicolas De Loof 8f2b747104 use DistributionInspect to resolve image digest
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-11-30 21:18:18 +01:00
Nicolas De Loof 9ac4f69918 move image digests resolution to backend
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-11-30 21:18:18 +01:00
Guillaume Lours 707d55c77f add file header and cleanup profiles e2e tests
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-11-30 13:21:16 +01:00
Guillaume Lours 5edd783032 add e2e tests to check profile activation via targeted service
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-11-30 13:21:16 +01:00
Guillaume Lours 6fbef29619 add e2e tests to check no profile usages
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-11-30 13:21:16 +01:00
Guillaume Lours 7fe43a8b4a add e2e tests using explicitly profiles
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-11-30 13:21:16 +01:00
Nicolas De Loof ed38fe0da8 only stop services started by `up` on interruption
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-11-30 08:07:20 +01:00
Nicolas De Loof fb5b90ed47 implement support for oom_score_adj
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-11-25 09:03:12 +01:00
Guillaume Lours 10a5d998e6 useDockerDefaultOrServicePlatform fct should return service.platform if defined
and present in the build.platforms list (or if the list is empty)

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-11-25 09:03:03 +01:00
Guillaume Lours 02818ba6c7
Merge pull request #9998 from glours/display-engine-warnings
display creation warnings from the engine
2022-11-21 15:17:26 +01:00
Guillaume Lours 481ae0aa7d
Merge pull request #9999 from glours/pull-use-default-platform
use platform defined by DOCKER_DEFAULT_PLATFORM when pulling and no service platform defined
2022-11-18 14:27:41 +01:00
Nicolas De Loof 19d6ca9c5d ignore error parsing container number label, just warn
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-11-17 15:18:28 +01:00
Guillaume Lours 7c5675c306
use platform defined by DOCKER_DEFAULT_PLATFORM when pulling and no service platform defined
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-11-16 13:51:44 +01:00
Guillaume Lours a077e8a24b display creation warnings from the engine
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-11-15 18:12:14 +01:00
Guillaume Lours 8c1e2af3e1 add e2e tests to check build dependency between services
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-11-15 14:43:53 +01:00
Guillaume Lours a9e070206e check if a missing image won't be build via a service declared in depends_on section
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-11-15 14:43:53 +01:00
Sebastiaan van Stijn 34e945a598
ci: remove uses of deprecated gotest.tools v2 (#9935)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-07 14:07:41 -05:00
Laura Brehm df9e605b31
Merge pull request #9947 from glours/manage-resources-reservations
add support of deploy.reservation.memory
2022-11-02 16:09:14 +01:00
Guillaume Lours 7ba9aac5da add support of deploy.reservation.memory
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-10-24 22:52:34 +02:00
Guillaume Lours eaf27d9dfe
map deploy.restart_policy.condition to engine values
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-10-24 11:38:49 +02:00
Laura Brehm dd13299ede
Skip flaky test in CI
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-10-20 18:30:27 +02:00
Guillaume Lours 3f0550f884
log the error object instead of the string message only
Co-authored-by: Nick Sieger <nicksieger@gmail.com>
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-10-18 17:34:16 +02:00
Guillaume Lours 18ce1f41b7
replace deprecated functions
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-10-18 16:57:53 +02:00
Guillaume Lours 3bf29d401c bump docker dependencies version
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-10-18 16:26:54 +02:00
Ulysses Souza 91eae4f035 Add Codecov
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2022-10-17 15:32:51 +02:00
Tiago Silva 8b89721476
port: fix container name in error message (#9909)
The error message is using V1 separator hardcoded, it should be using the configured separator value.

Signed-off-by: Tiago Silva <Tiago.MB.Silva@edu.azores.gov.pt>
2022-10-13 14:47:35 -04:00
Vedant Koditkar 1d4cb32001
Add support to push images quietly via compose cli
Signed-off-by: Vedant Koditkar <vedant.koditkar@outlook.com>
2022-10-11 15:19:23 -05:00
Guillaume Lours b6b58d26c1 don't fail when trying to remove an orphan container during down command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-10-06 16:44:37 +02:00
Laura Brehm 25c4bcef85
Merge pull request #9824 from laurazard/cucumber-test
🥒 Cucumber PoC 🥒
2022-09-27 23:38:44 +02:00
Milas Bowman 616777eb4a
deps: fix race condition during graph traversal (#9878)
Keep track of visited nodes to prevent visiting a service multiple
times. This is possible when a service depends on multiple others,
as an attempt could be made to visit it from multiple parents.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-09-27 09:01:13 -04:00
Laura Brehm fffe7fff57
Create new `e2e` module to separate out test dependencies, move cucumber tests
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-09-27 02:13:52 +02:00
Laura Brehm 0a5f4e62e4
Removed tests that were replaced by Cucumber features
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-09-27 02:13:52 +02:00
Laura Brehm 266ab22d53
Rename start cucumber feature
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-09-27 02:13:51 +02:00
Laura Brehm a7476c8eeb
Convert `cascade_stop_test.go` into a cucumber feature `stop.feature`
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-09-27 02:13:51 +02:00
Laura Brehm 15ebff00b1
Cucumber test setup/fixtures
(run with `go test -v -run ^TestCucumberFeatures$ github.com/docker/compose/v2/pkg/e2e/cucumber`)

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-09-27 02:13:47 +02:00
Bartłomiej Klimczak aa297a9969
remove unnecessary code
Signed-off-by: Bartłomiej Klimczak <bartlomiej.klimczak88@gmail.com>
2022-09-26 20:54:33 +02:00
Bartłomiej Klimczak 0d0a02cc6b
add more information when service.platform isn't part of service.build.platforms
Signed-off-by: Bartłomiej Klimczak <bartlomiej.klimczak88@gmail.com>
2022-09-26 20:44:59 +02:00
Guillaume Lours 279225896a
run: clean service command if entrypoint is overridden (#9836)
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-09-26 12:08:14 -04:00
Guillaume Lours ce3700d334 keep the platform defined, in priority, via DOCKER_DEFAULT_PLATFORM or the service.plaform one if no build platforms provided
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-09-22 13:46:24 +02:00
Guillaume Lours e2a3fe9427
Merge pull request #9862 from glours/use-docker-export-if-no-build-platforms
configure default builder export when no build.platforms defined
2022-09-22 13:46:00 +02:00
Laura Brehm 94465d57cc
Merge pull request #9863 from docker/gha-win-mac-runners
Add `merge` GitHub Actions workflow to run tests on Windows and macOS runners
2022-09-21 16:39:27 +02:00
Laura Brehm a1984ca1de
Skip some tests in CI due to flakiness
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-09-20 11:33:31 -04:00
Laura Brehm 118b4f07e5
Increase E2E test timeouts to reduce flakiness
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-09-20 11:33:31 -04:00
Laura Brehm 8714f983ac
Temporarily disable broken E2E tests on Windows
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-09-20 11:33:31 -04:00
Laura Brehm 937fa2dc8f
Add GitHub Action workflow to run tests on Mac/Windows runners
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-09-20 11:33:28 -04:00
Guillaume Lours 71ab6c9eef
configure default builder export when no build.platforms defined
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-09-20 15:27:41 +02:00
Guillaume Lours a1c50ef2c9
keep the platform defined via DOCKER_DEFAULT_PLATFORM during build if no build platforms provided
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-09-16 22:19:31 +02:00
Laura Brehm 2977f4c897
Merge pull request #9849 from laurazard/fix-volumesfrom-overwriting
Keep `depends_on` condition when service has `volumes_from`
2022-09-15 10:45:48 -04:00
Laura Brehm cfdec21a7f
Fix linting issues
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-09-15 10:04:06 -04:00
Laura Brehm b564cc5a17
Don't overwrite existing dependency condition
(when service has `volumes_from` another service with dependency condition)

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-09-15 09:53:52 -04:00
Laura Brehm 43c444e890
Add unit tests for `PrepareVolumes`
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-09-15 09:53:14 -04:00
Guillaume Lours 0e975262da
keep the platform defined at service level during build if no build platforms provided
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-09-15 08:30:52 +02:00
Milas Bowman 801678686c add license to file
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-09-13 18:29:42 +01:00
Milas Bowman 403d691abf small cleanup + godoc
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-09-13 18:29:33 +01:00
Milas Bowman b49b9ffe7e Merge remote-tracking branch 'upstream/v2' into down-image-rm 2022-09-13 18:00:41 +01:00
Milas Bowman 680763f8b7 down: refactor image pruning
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-09-13 17:23:44 +01:00
Risky Feryansyah d05f5f5fa7
pull: improve output for services with both image+build (#9829)
When an image pull fails but the service has a `build` section, it
will be built, so it's not an unrecoverable error. It's now logged as
a warning - in situations where the image will _never_ exist in a
registry, `pull_policy: never` can & should be used, which will
prevent the error and avoid unnecessary pull attempts.

Signed-off-by: Risky Feryansyah Pribadi <riskypribadi24@gmail.com>
2022-09-13 14:38:13 +01:00
Milas Bowman 61845dd781
logs: filter to services from current Compose file (#9811)
* logs: filter to services from current Compose file

When using the file model, only attach to services
referenced in the active Compose file.

For example, let's say you have `compose-base.yaml`
and `compose.yaml`, where the former only has a
subset of the services but are both run as part of
the same named project.

Project based command:
```
docker compose -p myproj logs
```
This should return logs for active services based
on the project name, regardless of Compose file
state on disk.

File based command:
```
docker compose --file compose-base.yaml logs
```
This should return logs for ONLY services that are
defined in `compose-base.yaml`. Any other services
are considered 'orphaned' within the context of the
command and should be ignored.

See also #9705.

Fixes #9801.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-09-08 16:26:00 -04:00