This is an automated email from the ASF dual-hosted git repository.
wu-sheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-infra-e2e.git
The following commit(s) were added to refs/heads/main by this push:
new 68bbdec Use Docker Compose v2 (`docker compose`) in the compose log
collector (#148)
68bbdec is described below
commit 68bbdec303cf2d3df9f2353f970f91938b52f674
Author: 吴晟 Wu Sheng <[email protected]>
AuthorDate: Thu Jun 18 08:26:46 2026 +0800
Use Docker Compose v2 (`docker compose`) in the compose log collector (#148)
* Use Docker Compose v2 (`docker compose`) in the compose log collector
The compose collector shells out to `docker-compose -f ... -p ... ps -q
...` (Compose
v1) to locate containers for log collection. GitHub-hosted `ubuntu-24.04`
runners no
longer ship the standalone `docker-compose` (v1) binary, so collection
fails with
`docker-compose: command not found` on every failed e2e (setup already uses
Compose v2
via testcontainers-go, so only the collector was still on v1).
Switch `ComposeCommand` from `docker-compose` to `docker compose`. The
command is run
via `bash -ec`, so the two-word v2 plugin invocation works as-is, and v2
accepts the
same `-f / -p / ps -q` flags.
Validated locally with a compose e2e (nginx): with `docker-compose` v1
absent (and with
a failing `docker-compose` stub shadowing PATH), `e2e run` completes green
and the
collector gathers container files via `docker compose` v2 without ever
invoking
`docker-compose`.
* Add CI coverage for the compose log collector
infra-e2e's own e2e (`test/e2e/e2e.yaml`) runs on `ubuntu-latest` (which
ships only
Docker Compose v2) but never exercised the compose log collector, so the
v1->v2
breakage slipped through CI and the prior fix had no regression guard.
Add a `cleanup.collect` config (httpbin / /etc/hostname) and a verify case
that runs
`e2e collect` against the already-running stack and asserts a container
file was
gathered. The collector now runs in CI on a v1-less runner, proving it
works via
`docker compose` v2 and failing the build if it ever regresses to
`docker-compose` v1.
Validated locally: `e2e collect` gathers /etc/hostname from the httpbin
service and the
verify case reports `1 passed`.
---
internal/constant/compose.go | 2 +-
test/e2e/collect-expected.yaml | 18 ++++++++++++++++++
test/e2e/e2e.yaml | 21 +++++++++++++++++++++
3 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/internal/constant/compose.go b/internal/constant/compose.go
index 30992c4..3b47be9 100644
--- a/internal/constant/compose.go
+++ b/internal/constant/compose.go
@@ -20,5 +20,5 @@ package constant
const (
Compose = "compose"
- ComposeCommand = "docker-compose"
+ ComposeCommand = "docker compose"
)
diff --git a/test/e2e/collect-expected.yaml b/test/e2e/collect-expected.yaml
new file mode 100644
index 0000000..c99cbdf
--- /dev/null
+++ b/test/e2e/collect-expected.yaml
@@ -0,0 +1,18 @@
+# Licensed to Apache Software Foundation (ASF) under one or more contributor
+# license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright
+# ownership. Apache Software Foundation (ASF) licenses this file to you under
+# the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+collected: "true"
diff --git a/test/e2e/e2e.yaml b/test/e2e/e2e.yaml
index 23cb116..6bb2128 100644
--- a/test/e2e/e2e.yaml
+++ b/test/e2e/e2e.yaml
@@ -24,6 +24,17 @@ setup:
cleanup:
# always never success failure
on: always
+ # Exercise the compose log collector in CI so a regression to Docker Compose
v1 is
+ # caught: GitHub-hosted runners ship only Compose v2, so the collector must
use
+ # `docker compose`. Auto-collect is off here; the verify case below invokes
+ # `e2e collect` explicitly and asserts a file was collected.
+ collect:
+ on: never
+ output-dir: /tmp/e2e-collect-check
+ items:
+ - service: httpbin
+ paths:
+ - /etc/hostname
verify:
# verify with retry strategy
@@ -56,3 +67,13 @@ verify:
query: './bin/linux/e2e verify -c
./test/e2e/concurrency/non-fail-fast/internal/verify.yaml --summary-only -o
yaml'
expected: ./concurrency/non-fail-fast/expected.yaml
+ # Guards the compose log collector against a regression to Docker Compose
v1
+ # (which is absent on GitHub-hosted runners). Runs `e2e collect` against
the
+ # already-running compose stack and asserts a container file was collected.
+ - name: compose log collector works on Docker Compose v2
+ query: |
+ rm -rf /tmp/e2e-collect-check
+ ./bin/linux/e2e collect -c ./test/e2e/e2e.yaml > /dev/null 2>&1 || true
+ if [ -s /tmp/e2e-collect-check/httpbin/etc/hostname ]; then echo
'collected: "true"'; else echo 'collected: "false"'; fi
+ expected: ./collect-expected.yaml
+