Commit Graph

402 Commits

Author SHA1 Message Date
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
Lucas Berg 7a8d157871
convert: do not escape $ into $$ when using the --no-interpolate option (#9703)
Signed-off-by: Lucas Berg <root.lucasberg@gmail.com>
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
Co-authored-by: Ulysses Souza <ulyssessouza@gmail.com>
2022-09-08 16:25:23 -04:00
Laura Brehm 88df5ede42
Merge pull request #9797 from laurazard/start-only-services
Only attempt to start specified services on `compose start [services]`
2022-09-08 13:00:20 -04:00
Laura Brehm a7cc406187
Cleanup E2E tests
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-09-08 12:49:42 -04:00
Laura Brehm 4c474fe029
Add unit tests to graph building logic in `dependencies.go`
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-09-08 12:32:04 -04:00
Laura Brehm 209293e449
Restrict compose project to selected services and dependencies on `compose start`
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-09-08 12:31:55 -04:00
Guillaume Lours 0ac0e29294
Merge pull request #9729 from glours/add-platforms-build
Add platforms build
2022-09-08 11:42:16 +02:00
Milas Bowman bc806da712 build: label built images for reliable cleanup on `down`
When running `compose down`, the `--rmi` flag can be passed,
which currently supports two values:
 * `local`: remove any _implicitly-named_ images that Compose
            built
 * `all`  : remove any named images (locally-built or fetched
            from a remote repo)

Removing images in the `local` case can be problematic, as it's
historically been done via a fair amount of inference over the
Compose model. Additionally, when using the "project-model"
(by passing `--project-name` instead of using a Compose file),
we're even more limited: if no containers for the project are
running, there's nothing to derive state from to perform the
inference on.

As a first pass, we started labeling _containers_ with the name
of the locally-built image associated with it (if any) in #9715.
Unfortunately, this still suffers from the aforementioned problems
around using actual state (i.e. the containers might no longer
exist) and meant that when operating in file mode (the default),
things did not behave as expected: the label is not available
in the project since it only exists at runtime.

Now, with these changes, Compose will label any images it builds
with project metadata. Upon cleanup during `down`, the engine
image API is queried for related images and matched up with the
services for the project. As a fallback for images built with
prior versions of Compose, the previous approach is still taken.

See also:
 * https://github.com/docker/compose/issues/9655
 * https://github.com/docker/compose/pull/9715

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-09-07 17:57:29 -04:00
Laura Brehm 361194472e
Cleanup E2E tests
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-09-06 20:28:35 +02:00
Risky Feryansyah Pribadi 07eb8a598d patch: build.go access custom labels directly cause panic
Signed-off-by: Risky Feryansyah Pribadi <riskypribadi24@gmail.com>
2022-09-06 22:46:55 +07:00
Guillaume Lours 44c55e89c0 always use 'docker' export entry when building with 'up' or 'run' commands
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-09-02 15:44:55 +02:00
Guillaume Lours e016faac33 don't push images at the end of multi-arch build (and simplify e2e tests)
support DOCKER_DEFAULT_PLATFORM when 'compose up --build'
add tests to check behaviour when DOCKER_DEFAULT_PLATFORM is defined

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-09-02 15:44:55 +02:00
Guillaume Lours 8ed2d8ad07 add a test with multiple service builds using platforms in the same compose file
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-09-02 15:44:55 +02:00