From 3982e24f5c58cbfbfce267271ea84944062ae5d5 Mon Sep 17 00:00:00 2001 From: Arne Welzel Date: Fri, 15 Mar 2024 11:29:33 +0100 Subject: [PATCH 1/2] docker-compose: Switch to docker compose v2 docker-compose v1 (implemented in Python) has stopped receiving update in July 2023 and the version installed on Cirrus's docker_builder image is incompatible with the latest docker-py version, resulting in total test failures. This commit switches over the docker-compose invocations to 'docker compose' as required by docker compose v2. compose is now a plugin of docker, implemented in Go. It's installable on Ubuntu, for example, as docker-compose-v2 package. --- Scripts/docker-compose-teardown | 4 ++-- Scripts/docker-requirements | 4 ++-- Scripts/docker-setup | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Scripts/docker-compose-teardown b/Scripts/docker-compose-teardown index 4590c79..bf80839 100755 --- a/Scripts/docker-compose-teardown +++ b/Scripts/docker-compose-teardown @@ -12,7 +12,7 @@ if docker ps -a | grep -q $controller; then fi # Grab the Docker logs -docker-compose -p ${testname}_ -f docker-compose.yml logs >docker-compose.logs +docker compose -p ${testname}_ -f docker-compose.yml logs >docker-compose.logs [ -n "$TEST_SKIP_DOCKER_TEARDOWN" ] && exit 0 [ "$TEST_FAILED" -eq 1 ] && [ -n "$TEST_SKIP_DOCKER_TEARDOWN_ON_FAILURE" ] && exit 0 @@ -28,6 +28,6 @@ if [ ! -f docker-compose.yml ]; then fi # Don't wait at all for clean container shutdown -docker-compose -p ${testname}_ -f docker-compose.yml down -t 0 +docker compose -p ${testname}_ -f docker-compose.yml down -t 0 exit 0 diff --git a/Scripts/docker-requirements b/Scripts/docker-requirements index a871c8c..a5355ed 100755 --- a/Scripts/docker-requirements +++ b/Scripts/docker-requirements @@ -11,8 +11,8 @@ command -v docker >/dev/null || { exit 1 } -command -v docker-compose >/dev/null || { - echo "docker-compose command unavailable" +docker compose version >/dev/null || { + echo "docker compose plugin unavailable" exit 1 } diff --git a/Scripts/docker-setup b/Scripts/docker-setup index 2d502ac..f123dba 100644 --- a/Scripts/docker-setup +++ b/Scripts/docker-setup @@ -46,16 +46,16 @@ docker_populate() { fi } -# The corresponding "docker-compose down" happens in docker-compose-teardown. +# The corresponding "docker compose down" happens in docker-compose-teardown. # Might shift this around in the future for better symmetry. docker_compose_up() { local config1="${1:-docker-compose.yml}" local config2="${2:-docker-compose.override.yml}" if [ -f "${config2}" ]; then - docker-compose -p ${testname} -f "$config1" -f "$config2" up -d + docker compose -p ${testname} -f "$config1" -f "$config2" up -d else - docker-compose -p ${testname} -f "$config1" up -d + docker compose -p ${testname} -f "$config1" up -d fi } From 2e9afe252ba234aeac40317e9b4708857a40c8a2 Mon Sep 17 00:00:00 2001 From: Arne Welzel Date: Fri, 15 Mar 2024 11:18:38 +0100 Subject: [PATCH 2/2] Docker/setups: Fix multiple merge keys in yaml > YAML parsing was improved in [docker-compose] v2.17 - the old behavior of > allowing multiple merge keys was a quirk of the parser. Reference: https://github.com/docker/compose/issues/10394#issuecomment-1481300567 --- Docker/setups/default/docker-compose.yml | 9 +++------ Docker/setups/singlehost/docker-compose.yml | 6 ++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Docker/setups/default/docker-compose.yml b/Docker/setups/default/docker-compose.yml index 3d7f282..4ce2cc3 100644 --- a/Docker/setups/default/docker-compose.yml +++ b/Docker/setups/default/docker-compose.yml @@ -23,16 +23,13 @@ x-zeek-controller: &ZEEK_CONTROLLER services: controller: - <<: *ZEEK_BASE - <<: *ZEEK_CONTROLLER + <<: [*ZEEK_BASE, *ZEEK_CONTROLLER] inst1: - <<: *ZEEK_BASE - <<: *ZEEK_AGENT + <<: [*ZEEK_BASE, *ZEEK_AGENT] inst2: - <<: *ZEEK_BASE - <<: *ZEEK_AGENT + <<: [*ZEEK_BASE, *ZEEK_AGENT] client: image: zeektest:latest diff --git a/Docker/setups/singlehost/docker-compose.yml b/Docker/setups/singlehost/docker-compose.yml index 7e0cdc2..3ee9a2b 100644 --- a/Docker/setups/singlehost/docker-compose.yml +++ b/Docker/setups/singlehost/docker-compose.yml @@ -29,9 +29,7 @@ x-zeek-client: &ZEEK_CLIENT services: controller: - <<: *ZEEK_BASE - <<: *ZEEK_CONTROLLER + <<: [*ZEEK_BASE, *ZEEK_CONTROLLER] client: - <<: *ZEEK_BASE - <<: *ZEEK_CLIENT + <<: [*ZEEK_BASE, *ZEEK_CLIENT]