Commit Graph

306 Commits

Author SHA1 Message Date
Milas Bowman 3ae6c52e8a e2e: add extra tools needed for ddev test
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-16 09:38:25 -04:00
Milas Bowman 1c41df8f56 e2e: robustness changes for ddev test
The most important change here is to ensure that the correct Compose
standalone binary is used by `ddev`. Since it invokes Compose itself,
we need to ensure that `PATH` is set appropriately such that it finds
the binary we want to test rather than something from the system.

As part of this, the rest of the environment has been isolated, which
should make the test more reliable, and avoids polluting `~/.ddev`
with test artifacts by using a tmpdir as `HOME` for the test instead
of the user's real home folder.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-16 08:59:02 -04:00
Milas Bowman ea8341865d e2e: isolate test command env from system env
When running Docker / Compose commands, do NOT inherit the system
environment to ensure that the tests are reproducible regardless
of host settings.

Additionally, per-command environment overrides are provided to
the command instead of using `os.SetEnv`, as this is not safe when
running tests in parallel (`testing.T::SetEnv` will actually error
if used in this way!)

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-16 08:30:57 -04:00
Milas Bowman d9065050fd e2e: fix subtests and block parallel unsafe tests
The big mechanical change here is to NOT store `t` as a field on
the `CLI` object (which has been renamed as well to fix the odd
capitalization). The way the tests are structured meant that the
"subtests" were using the _parent_ `*testing.T` instance, which
causes various oddities including confusing messages on failure
about a child test causing a panic in the parent.

Additionally, a few tests have been blocked from running in
parallel because they are sharing `compose.yaml` fixtures and
can fail as a result (e.g. due to a port conflict on the host).
I'll fix these in follow-up PRs but want to focus on correctness
for the tests before optimizing them.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-15 16:27:30 -04:00
Nicolas De Loof 005fc25823 add support for setting secret from env variable
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-06-15 17:06:48 +02:00
Bastian Venthur 8a5d555de7 fixed some spelling mistakes
that's all :)

Signed-off-by: Bastian Venthur <venthur@debian.org>
2022-06-14 21:33:36 +02:00
Nick Sieger a48f1e8c13
Merge pull request #9547 from docker/nicksieger/e2e-ps-unmarshal
e2e: unmarshal json into container summaries
2022-06-14 10:33:53 -05:00
Guillaume Lours 57975094cc
Merge pull request #9552 from glours/fix-deploy-cpus-issue
Fix deploy cpus issue and support pids limit
2022-06-14 11:41:35 +02:00
Laura Brehm 80b7a8d274 Only start direct dependencies of service on `compose run ...`
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-06-14 07:32:15 +02:00
Guillaume Lours e111b651b3 add deploy.resourses.limits.pids to the managed resources
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-06-13 17:21:48 +02:00
Guillaume Lours 638d78516a parse deploy.resources.limit.cpus as float before converting
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-06-13 17:21:48 +02:00
Guillaume Lours 8862f95858
Merge pull request #9514 from ulyssessouza/fix-bindmounts
Fix bind mounts when in project volumes definition
2022-06-09 11:15:24 +02:00
Nick Sieger ebb45b400c
e2e: unmarshal json into container summaries
Signed-off-by: Nick Sieger <nick@nicksieger.com>
2022-06-08 15:13:31 -05:00
Nick Sieger c83133f73b
e2e: add test for ps
Signed-off-by: Nick Sieger <nick@nicksieger.com>
2022-06-08 14:05:20 -05:00
Nick Sieger 3599fc8533
mocks: create mocks for compose api.Service
Signed-off-by: Nick Sieger <nick@nicksieger.com>
2022-06-07 17:09:06 -05:00
Ulysses Souza 919f351b4b Fix bind mounts when in project volumes definition
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2022-06-02 16:37:24 +02:00
Guillaume Lours d5528f3a54
Merge pull request #9520 from milas/bugfix-network-ambiguity
fix: prevent network name ambiguity
2022-06-02 12:44:12 +02:00
Laura Brehm 81182fca53 Add links to container create request.
In v1, links were sent alongside the rest of the container create request, as part of `HostConfig`. In v2, links are usually set on the connect container to network request that happens after the create. However, this only happens if the service has one or more networks defined for it. If the services are configured to use the default bridge network, this request is not made and so links are never configured.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-06-02 02:51:25 +02:00
Milas Bowman 7f32f02817 fix: prevent network name ambiguity
`NetworkInspect` will match a network ID by prefix. While rare,
it's possible that users might use a network name that is also
a valid network ID prefix for a pre-existing Docker network.
(In the reported case, the network was named `db`, for example.)

Fixes #9496.

Signed-off-by: Milas Bowman <milas@tilt.dev>
2022-06-01 15:28:42 -04:00
Guillaume Lours 335decceda
Merge pull request #9504 from docker/nicksieger/9427
fix: bring up services with deps with --no-deps
2022-05-31 23:39:19 +02:00
Nick Sieger 28c0fbfdc0
e2e: reproduce bug with links
Signed-off-by: Nick Sieger <nick@nicksieger.com>
2022-05-31 16:32:29 -05:00
Nick Sieger cacff89cef
fix: bring up services with deps with --no-deps
Don't fail on not finding dependent services because they were put in the
disabled slice.

Fixes #9427.

Signed-off-by: Nick Sieger <nick@nicksieger.com>
2022-05-31 16:19:21 -05:00
Guillaume Lours a1b3f95709
add e2e tests to verify env variables priority
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-05-30 17:11:49 +02:00
Guillaume Lours e806acce88
Merge pull request #9481 from glours/add-tags-to-build
add tags property to build section
2022-05-23 10:23:40 +02:00
Guillaume Lours 285a9c94f7
Merge pull request #9476 from maxcleme/9469-fix-flickering-prompt
fix: prevent flickering prompt when pulling same image from N services
2022-05-20 22:09:02 +02:00
Ulysses Souza b961d49859
Merge pull request #9033 from ulyssessouza/add-e2e-ddev
Add ddev's e2e test
2022-05-20 20:02:58 +02:00
Guillaume Lours 9cae9eb0fe
Merge pull request #9488 from ndeloof/attach_profiles
attach _only_ to services declared by project applying profiles
2022-05-20 14:38:08 +02:00
Nicolas De Loof 8d03e29994
attach _only_ to services declared by project applying profiles
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-05-20 10:36:06 +02:00
Guillaume Lours 7ee7becd01 fix TestLocalComposeUp which fail locally
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-05-20 07:36:34 +02:00
Randy Fay 97d46a14ef Fix problems with ddev e2e test and minor cleanup, add tmate (#27)
* Add tmate for debugging
* Use -parallel=1 for standaone tests

Signed-off-by: Randy Fay <randy@randyfay.com>
2022-05-19 14:14:03 +02:00
Ulysses Souza a5a1c5f2f1 Add ddev's e2e test
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2022-05-19 14:14:03 +02:00
Guillaume Lours a2770b66ff
add tags property to build section
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-05-18 14:43:54 +02:00
Maxime CLEMENT 48b150beff fix: prevent flickering prompt when pulling same image from N services
Signed-off-by: Maxime CLEMENT <maxime.clement@docker.com>
2022-05-18 08:58:06 +02:00
Nicolas De Loof 65b827d08f
bump compose-go to 1.2.5
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-05-17 17:11:32 +02:00
Guillaume Lours a603e27117 cp command from service to host: use the first container found to copy source on the host
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-05-10 10:50:40 +02:00
Guillaume Lours a964d5587b align cp command index management with exec command
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-05-10 10:50:40 +02:00
Guillaume Lours a983cf551d cp command: copy to all containers of a service as default behaviour
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-05-10 10:50:40 +02:00
Nicolas De Loof 78b06764a1
compose down exit=0 if nothing to remove
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-05-04 13:51:21 +02:00
Eric Fan 41b3967cb5 Fix cannot setup IPAM gateway
Signed-off-by: Eric Fan <ericfan@qnap.com>
2022-04-24 17:30:27 +02:00
Nicolas De Loof 00fd1c1530 inspect image ID after pull to se com.docker.compose.image
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-04-21 22:42:29 +02:00
Nicolas De Loof 0dffd5ba9f add support for build.secrets
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-04-13 22:45:53 +02:00
Nicolas De Loof e01687430e when using `bind` API, use compose-go to (re)build volume string
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-04-13 22:45:53 +02:00
Nicolas De Loof 9668f600d1
project name MUST be lowercase
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-04-13 09:49:01 +02:00
Nicolas De Loof 672e2367fb don't ignore error
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-04-12 16:00:36 +02:00
Nicolas De Loof 625a48dcf7 `pull` to respect pull_policy
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-04-12 07:59:58 +02:00
Nicolas De Loof 500555b834
linter
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-04-08 11:41:46 +02:00
Nicolas De Loof e766352d81
include services declared by `links` as implicit dependencies
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-04-08 10:32:36 +02:00
Nicolas De Loof db698562a9 use project we just created to start services
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-04-07 13:38:30 +02:00
Guillaume Lours 7fea9f7e8b use project instead of DownOptions.project to list service images in pkg.compose.down
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-04-05 08:24:25 +02:00
Nicolas De Loof c9fbb9ba9c
inspect container before attachment to use the adequate logic regarding TTY
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-04-04 14:39:38 +02:00
Guillaume Lours f2d9acd3d4 use ssh config when building from compose up
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-04-04 10:16:28 +02:00
Guillaume Lours fcff36fc8a now we use directly the Docker CLI to run autoremove flag should be pass as is
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-04-02 08:45:51 +02:00
Ulysses Souza 56e48f8360 Fix down command without any resource to delete
A command down without any resource to delete was
trying to remove a default network that doesn't exist

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2022-03-31 18:30:29 +02:00
Guillaume Lours 934b596e00 add e2e tests to check usage of ssh build property
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-03-31 12:47:15 +02:00
Guillaume Lours ff73827a6f Add support of ssh authentications defined in compose file or via cli flags
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-03-31 12:47:15 +02:00
Guillaume Lours 9b02add4df
fix race condition on start-stop e2e tests running in parrallel
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-03-31 11:16:18 +02:00
Nicolas De Loof 890b6808a2
support cache_from|to|no|pull
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-28 09:36:24 +02:00
Nicolas De Loof c843d373de restore TTY auto-detection using dockerCli.Out.IsTerminal
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-16 16:34:26 +01:00
Nicolas De Loof 1d4b4e3c8e use docker/cli RunExec and RunStart to handle all the interactive/tty/* terminal logic
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-16 16:34:26 +01:00
Guillaume Lours d999c230a5
Merge pull request #9281 from ndeloof/down_volume_external
don't remove external volumes/networks
2022-03-14 17:21:04 +01:00
Nicolas De Loof e7f545907b
don't remove external volumes/networks
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-14 15:24:49 +01:00
Guillaume Lours 730609b359
Merge pull request #9280 from ndeloof/kill
kill only need project name
2022-03-14 10:33:21 +01:00
Nicolas De Loof cd8074d501
kill only need project name
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-14 10:26:36 +01:00
Nicolas De Loof 283f7a1ec5 Bump buildx to v0.8.0
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-11 14:05:55 +01:00
Nicolas De Loof 85a4d04096
recreate container after image has been rebuilt/pulled
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-10 11:02:48 +01:00
Nicolas De Loof 5e8040ea18
don't fail trying to remove container with no candidate
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-09 16:24:16 +01:00
Guillaume Lours 7036cda306
Merge pull request #9198 from ndeloof/dockerCli_stdout
composeService to use dockerCli's In/Out/Err streams
2022-03-09 14:36:07 +01:00
Guillaume Lours 540ad83a6d
Merge pull request #9251 from ndeloof/device_cgroup_rules
add support for device_cgroup_rules
2022-03-09 13:27:53 +01:00
Guillaume Lours a97576e844
add run with dependencies e2e test
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-03-09 12:22:38 +01:00
Nicolas De Loof d8775c7a28
add support for device_cgroup_rules
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-09 11:39:20 +01:00
Nicolas De Loof 158b5ff6a3 build full compose model from resources, then filter by services
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-09 11:29:30 +01:00
Nicolas De Loof 57e8e8ef29
use plain text progress when ansi=never is set
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-08 15:05:37 +01:00
Nicolas De Loof 8c7951465e filter containers after project has been rebuilt from resources
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-08 09:47:22 +01:00
Nicolas De Loof 22b8c731c7
prevent getCanonicalContainerName to crash
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-07 14:58:39 +01:00
Guillaume Lours 0ef4b90fae don't failed when trying to stop or rm services with no containers running
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-03-07 10:35:22 +01:00
Nicolas De Loof dbe7de50a7 don't try to start dependencies when there are none
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-07 08:25:05 +01:00
PIG208 bcaa908f74 Support COMPOSE_IGNORE_ORPHANS for compose run
This revives #7020 and resolves the issue mentioned in #4992.

Signed-off-by: Zixuan James Li <359101898@qq.com>
2022-03-05 22:54:16 +01:00
Ulysses Souza 67b4669f9b Add function to convert strings to bool
Typically used on boolean environment variable values

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2022-03-04 16:42:37 +01:00
Nicolas De Loof f86f252a66 composeService to use dockerCli's In/Out/Err streams
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-03 16:34:57 +01:00
Nicolas De Loof 52eeda9aa7 report external volume name not found
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-02 08:09:31 +01:00
Ulysses Souza 16914e372e Bump compose-go 1.1.0
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2022-03-01 15:52:14 +01:00
Guillaume Lours ec080f184a
Merge pull request #9214 from ndeloof/inconsistent_hash
exclude com.docker.compose.image label from service hash
2022-02-28 10:20:36 +01:00
Nicolas De Loof b5b8e7a116
exclude com.docker.compose.image label from service hash
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-02-28 10:10:39 +01:00
Mehrad Dadar 9c68c76bea minor improvement and fix
Signed-off-by: Mehrad Dadar <mehrad.dadar@gmail.com>
2022-02-27 03:40:46 +03:30
Mehrad Dadar aeb7448449 minor improvement and fix
Signed-off-by: Mehrad Dadar <mehrad.dadar@gmail.com>
2022-02-25 06:26:05 +03:30
Mehrad Dadar 42c3adb236 project existence check: added error message
Signed-off-by: Mehrad Dadar <mehrad.dadar@gmail.com>
2022-02-25 05:36:22 +03:30
Mehrad Dadar 35f37cd1f7 fix lint
Signed-off-by: Mehrad Dadar <mehrad.dadar@gmail.com>
2022-02-25 00:00:36 +03:30
Mehrad Dadar c0465616bb check service existence in project
Signed-off-by: Mehrad Dadar <mehrad.dadar@gmail.com>
2022-02-24 23:46:07 +03:30
Mehrad Dadar 32d44dfc25 added scale to toProjectName
Signed-off-by: Mehrad Dadar <mehrad.dadar@gmail.com>
2022-02-24 22:39:38 +03:30
Mehrad Dadar 5885a250bc
Merge branch 'docker:v2' into issue#9147 2022-02-24 18:03:05 +03:30
Mehrad Dadar ce1c788237 minor code cleanup
Signed-off-by: Mehrad Dadar <mehrad.dadar@gmail.com>
2022-02-24 14:50:50 +03:30
Mehrad Dadar 67f7b84829 modified com.docker.compose.depends_on label to contain dependency type
Signed-off-by: Mehrad Dadar <mehrad.dadar@gmail.com>
2022-02-23 21:34:34 +03:30
Ulysses Souza 8a9498c571
Merge pull request #9192 from glours/wait-and-scale-0
Wait and scale 0
2022-02-23 12:47:34 +01:00
Mehrad Dadar 7e7262bc77
Merge branch 'docker:v2' into issue#9147 2022-02-22 05:08:29 +03:30
Nicolas De Loof 981aea674d bump buildx to 0.7.1
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-02-21 14:28:22 +01:00
Guillaume Lours 64a9e4bf01
fix cyclomatic complexity of composeService.waitDependencies function
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-02-20 11:59:26 +01:00
Guillaume Lours 4be38f84df do not stop the dependencies wait process when reaching a dependency with service_started condition
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-02-20 10:28:34 +01:00
Guillaume Lours 09e0fa94b8 do not wait for dependencies with scale 0
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-02-20 10:28:34 +01:00
Vedant Koditkar cb45c6f2df Add unit tests for combinedConfigFiles logic
Signed-off-by: Vedant Koditkar <vedant.koditkar@outlook.com>
2022-02-18 16:37:35 +01:00
Vedant Koditkar 90ca37344f Update breaking test cases
Signed-off-by: Vedant Koditkar <vedant.koditkar@outlook.com>
2022-02-18 16:37:35 +01:00