Commit Graph

3348 Commits

Author SHA1 Message Date
Guillaume Lours 2cd9c0df5a
Merge pull request #9587 from milas/build-order-classic
build: respect dependency order for classic builder
2022-06-24 22:24:22 +02:00
Milas Bowman ec0efec839 test: add copyright notice
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-24 16:16:53 -04:00
Guillaume Lours dbf52d3f45
Merge pull request #9590 from docker/dependabot/go_modules/github.com/stretchr/testify-1.7.5
build(deps): bump github.com/stretchr/testify from 1.7.4 to 1.7.5
2022-06-24 11:36:32 +02:00
dependabot[bot] f972803104
build(deps): bump github.com/stretchr/testify from 1.7.4 to 1.7.5
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.4 to 1.7.5.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.4...v1.7.5)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-24 09:28:09 +00:00
Guillaume Lours 4aa3e246b7
Merge pull request #9585 from milas/net-ambiguity
networks: prevent issues due to duplicate names
2022-06-24 11:08:52 +02:00
Guillaume Lours a8a52f297a
Merge pull request #9582 from docker/dependabot/go_modules/github.com/cnabio/cnab-to-oci-0.3.4
build(deps): bump github.com/cnabio/cnab-to-oci from 0.3.3 to 0.3.4
2022-06-23 18:02:16 +02:00
Guillaume Lours ee8fed8abf
Merge pull request #9581 from docker/dependabot/go_modules/github.com/spf13/cobra-1.5.0
build(deps): bump github.com/spf13/cobra from 1.4.0 to 1.5.0
2022-06-23 17:54:40 +02:00
Guillaume Lours 4331b1ded1
Merge pull request #9580 from docker/dependabot/go_modules/github.com/stretchr/testify-1.7.4
build(deps): bump github.com/stretchr/testify from 1.7.2 to 1.7.4
2022-06-23 17:53:52 +02:00
dependabot[bot] 41dcb43dee
build(deps): bump github.com/cnabio/cnab-to-oci from 0.3.3 to 0.3.4
Bumps [github.com/cnabio/cnab-to-oci](https://github.com/cnabio/cnab-to-oci) from 0.3.3 to 0.3.4.
- [Release notes](https://github.com/cnabio/cnab-to-oci/releases)
- [Commits](https://github.com/cnabio/cnab-to-oci/compare/v0.3.3...v0.3.4)

---
updated-dependencies:
- dependency-name: github.com/cnabio/cnab-to-oci
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-23 14:54:35 +00:00
Milas Bowman 68cf8d5ca0
Merge pull request #9588 from milas/compose-go-v1.2.8
deps: upgrade to compose-go v1.2.8
2022-06-23 10:53:26 -04:00
Milas Bowman 94d6dff89d deps: upgrade to compose-go v1.2.8
https://github.com/compose-spec/compose-go/releases/tag/v1.2.8

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-23 10:45:45 -04:00
Milas Bowman 5f89365c8f network: make test mock consistent throughout
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-22 16:34:59 -04:00
Milas Bowman b2cd089bae build: respect dependency order for classic builder
When using the "classic" (non-BuildKit) builder, ensure that
services are iterated in dependency order for a build so that
it's possible to guarantee the presence of a base image that's
been added as a dependency with `depends_on`. This is a very
common pattern when using base images with Compose.

A fix for BuildKit is blocked currently until we can rely on a
newer version of the engine (see docker/compose#9324)[^1].

[^1]: https://github.com/docker/compose/issues/9232#issuecomment-1060389808

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-22 16:24:30 -04:00
Milas Bowman 0f747419b6 networks: prevent issues due to duplicate names
Within the Docker API/engine, networks have unique IDs, and the
name is a friendly label/alias, which notably does NOT have any
guarantees around uniqueness (see moby/moby#18864 [^1]).

During day-to-day interactive/CLI Compose usage, this is rarely
an issue, as Compose itself isn't creating networks concurrently
across goroutines. However, if multiple Compose instances are
executed simultaneously (e.g. as part of a test suite that runs
in parallel), this can easily occur.

When it does happen, it's very confusing for users and resolving
it via the `docker` CLI is not straightforward either [^2].

There's two primary changes here:
 * Pass `CheckDuplicates: true` to the Docker API when creating
   networks to reduce the likelihood of Compose creating duplicates
   in the first place
 * On `down`, list networks using a name filter and then remove
   them all by ID, as the Docker API will return an error if the
   name alias is used and maps to more than one network

Hopefully, this provides a better UX, since the issue should be
less likely to occur, and if it does, it can now be resolved via
standard Compose workflow commands.

[^1]: https://github.com/moby/moby/issues/18864
[^2]: https://stackoverflow.com/questions/63776518/error-2-matches-found-based-on-name-network-nameofservice-default-is-ambiguo

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-22 12:27:30 -04:00
dependabot[bot] 6df222f37d
build(deps): bump github.com/spf13/cobra from 1.4.0 to 1.5.0
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.4.0...v1.5.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-21 09:26:36 +00:00
dependabot[bot] aa851b0e27
build(deps): bump github.com/stretchr/testify from 1.7.2 to 1.7.4
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.2 to 1.7.4.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.2...v1.7.4)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-21 09:26:26 +00:00
Guillaume Lours e5dcb8a8f8
Merge pull request #9568 from milas/e2e-init-output
e2e: improve test output on failures
2022-06-18 20:59:56 +02:00
Milas Bowman ab25aabfb9
Merge pull request #9311 from quite/no-ansi-be-kind
Don't use ansi even when deprecated option is requested
2022-06-16 17:15:19 -04:00
Milas Bowman 7f441eb013 e2e: improve test output on failures
This is mostly marking a bunch of the run methods as helpers so
that the internal assertions they do will show the line number of
the calling test instead.

There's also some small tweaks around the plugin initialization to
help with the output in the event that it fails to make it easier
to debug what went wrong.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-16 17:05:43 -04:00
Guillaume Lours 4270987d7c
Merge pull request #9567 from milas/e2e-cmd
e2e: ensure all Compose cmds standalone compatible
2022-06-16 23:02:14 +02:00
Milas Bowman 3248b7b335 e2e: use Compose for exec test
This was using `docker exec` on Compose containers instead of
`docker compose exec` (and `docker-compose exec` for standalone).

Thanks to @glours for catching!

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-16 16:44:21 -04:00
Milas Bowman 4ea3ba77b2
Merge pull request #9559 from venthur/fix_spell
fixed some spelling mistakes
2022-06-16 15:56:44 -04:00
Milas Bowman 9622395c8a e2e: ensure all Compose cmds standalone compatible
The E2E tests can be run in plugin (`docker compose`) or standalone
(`docker-compose`) mode. Existing logic was in place to ensure that
the helper method is always used, which will invoke the right one
based on how tests are being executed.

However, this logic was too easy to (unintentionally) bypass given
the myriad of ways that commands can be run. The check has been
made stricter and pushed to a lower-level to more aggressively
catch instances.

As a result, a bunch of calls to `RunDockerCmd` are now updated
to be `RunDockerComposeCmd`, which will ensure that the invocation
is correct based on test mode.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-16 15:51:54 -04:00
Guillaume Lours bec4ea4ab0
Merge pull request #9566 from milas/e2e-ps-stdout
e2e: fix spurious `ps` failures
2022-06-16 18:07:22 +02:00
Guillaume Lours 3f10753178
Merge pull request #9563 from milas/e2e-env
e2e: isolate test command env from system env
2022-06-16 18:05:39 +02:00
Milas Bowman 152c2d9a33 e2e: fix spurious `ps` failures
Use the command `stdout` instead of combined `stdout` + `stderr`
for assertions to avoid failures from any CLI logging such as
warnings, which will be on `stderr`.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-16 11:28:29 -04:00
Milas Bowman a261682ca8 e2e: fix per-command env overrides
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-16 11:27:39 -04:00
Nick Sieger 71b89c2c1b
Merge pull request #9564 from docker/nicksieger/9562
down: fix COMPOSE_REMOVE_ORPHANS env name and add test
2022-06-16 09:01:00 -05:00
Milas Bowman ccd87311e8 e2e: always set HOME + USER for cmd env
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-06-16 09:44:40 -04:00
Nick Sieger 49fb4ca25f
down: fix COMPOSE_REMOVE_ORPHANS env name and add test
Fixes #9562.

Signed-off-by: Nick Sieger <nick@nicksieger.com>
2022-06-16 08:40:40 -05:00
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
Guillaume Lours de0f23315b
Merge pull request #9561 from milas/e2e-subtests
e2e: fix subtests and block parallel unsafe tests
2022-06-16 11:15:30 +02: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
Guillaume Lours c2533e2341
Merge pull request #9546 from docker/dependabot/go_modules/github.com/containerd/containerd-1.6.6
Bump github.com/containerd/containerd from 1.6.2 to 1.6.6
2022-06-08 22:44:37 +02:00
dependabot[bot] 08d8fddb8d
Bump github.com/containerd/containerd from 1.6.2 to 1.6.6
Bumps [github.com/containerd/containerd](https://github.com/containerd/containerd) from 1.6.2 to 1.6.6.
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.6.2...v1.6.6)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-08 20:15:39 +00:00
Guillaume Lours 5bd1a9bda3
Merge pull request #9545 from docker/nicksieger/ps-e2e-test
e2e: add test for ps
2022-06-08 22:13:37 +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
Guillaume Lours 78605e58b2
Merge pull request #9541 from docker/dependabot/go_modules/github.com/AlecAivazis/survey/v2-2.3.5
Bump github.com/AlecAivazis/survey/v2 from 2.3.2 to 2.3.5
2022-06-08 21:09:27 +02:00
Guillaume Lours 0ea3504fd5
Merge pull request #9544 from docker/dependabot/go_modules/github.com/docker/buildx-0.8.2
Bump github.com/docker/buildx from 0.8.1 to 0.8.2
2022-06-08 21:07:42 +02: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