compose/pkg/e2e
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
..
fixtures build: label built images for reliable cleanup on `down` 2022-09-07 17:57:29 -04:00
assert.go up: do not stop dependency containers (#9701) 2022-08-02 15:25:59 -04:00
buffer.go up: do not stop dependency containers (#9701) 2022-08-02 15:25:59 -04:00
build_test.go use '-' as separator by default for image name 2022-07-29 18:55:22 +02:00
cancel_test.go e2e: ensure all Compose cmds standalone compatible 2022-06-16 15:51:54 -04:00
cascade_stop_test.go e2e: ensure all Compose cmds standalone compatible 2022-06-16 15:51:54 -04:00
compose_down_test.go e2e: ensure all Compose cmds standalone compatible 2022-06-16 15:51:54 -04:00
compose_environment_test.go Give environment variables precedence back to OS over .env 2022-08-18 22:39:21 +02:00
compose_exec_test.go e2e: use Compose for exec test 2022-06-16 16:44:21 -04:00
compose_run_test.go if command is ran with a compose file, apply the compose model, not just project name 2022-08-02 22:33:26 +02:00
compose_test.go Pull image regardless of whether it exists locally if `tag=latest` 2022-08-23 16:57:40 +02:00
compose_up_test.go Add E2E tests for `up --exit-code-from` 2022-08-27 17:44:08 +02:00
cp_test.go e2e: fix subtests and block parallel unsafe tests 2022-06-15 16:27:30 -04:00
ddev_test.go e2e: always set HOME + USER for cmd env 2022-06-16 09:44:40 -04:00
e2e_config_plugin.go Use build tags for selecting e2e test mode 2021-12-09 10:52:18 +01:00
e2e_config_standalone.go Use build tags for selecting e2e test mode 2021-12-09 10:52:18 +01:00
framework.go Better sandboxed workflow and enhanced cross compilation 2022-08-12 15:05:58 +02:00
ipc_test.go e2e: fix subtests and block parallel unsafe tests 2022-06-15 16:27:30 -04:00
logs_test.go e2e: fix subtests and block parallel unsafe tests 2022-06-15 16:27:30 -04:00
main_test.go Use build tags for selecting e2e test mode 2021-12-09 10:52:18 +01:00
metrics_test.go e2e: ensure all Compose cmds standalone compatible 2022-06-16 15:51:54 -04:00
networks_test.go switch tests back to '_' separator for networks and volumes 2022-08-01 17:25:43 +02:00
pause_test.go e2e: split out `pause` tests and add more cases 2022-06-28 15:06:17 -04:00
ps_test.go e2e: fix spurious `ps` failures 2022-06-16 11:28:29 -04:00
pull_test.go Pull image regardless of whether it exists locally if `tag=latest` 2022-08-23 16:57:40 +02:00
recreate_no_deps_test.go up/start/run: don't wait for disabled service 2022-08-17 12:32:10 -05:00
restart_test.go e2e: ensure all Compose cmds standalone compatible 2022-06-16 15:51:54 -04:00
scan_message_test.go use '-' as separator by default for image name 2022-07-29 18:55:22 +02:00
secrets_test.go e2e: ensure all Compose cmds standalone compatible 2022-06-16 15:51:54 -04:00
start_stop_test.go Add E2E tests for `compose stop` with compose file 2022-08-02 22:33:26 +02:00
up_test.go up: do not stop dependency containers (#9701) 2022-08-02 15:25:59 -04:00
volumes_test.go lint: add `nolintlint` and clean up `nolint` directives (#9738) 2022-08-09 16:43:58 -04:00