Two CI jobs sharing one compose project: one job's teardown was the other's connection refused

The full local runner pass (act 0.2.89, catthehacker/ubuntu:act-latest) on this
tree went 4 jobs succeeded, 1 failed: the console job died 33 s in, at the
seeding curl of scripts/console-smoke.sh, with curl exit 7 — nothing listening on
127.0.0.1:8080 any more.

Not a product failure and not flakiness. The image job and the console job each
run `docker compose up -d` and each tear the stack down on exit, and both take the
project name from the repository directory and the host port from a literal 8080
in docker-compose.yml. On any machine where two jobs share one docker daemon — a
self-hosted runner, or act — they are the same stack, so the image job's
`compose down` removes the containers the console job is seeding into. Run alone,
the same console job passes (act -j console: 1 job succeeded, 53 assertions). On
GitHub's hosted runners each job gets its own machine, which is exactly why this
has never been seen there and why "the workflow has never run on GitHub" is still
a gap this repository carries rather than a solved problem.

Fix: the published port is ${EDGE_PORT:-8080}, and each job names its own compose
project (openwafci-image on 8080, openwafci-console on 8090). Separate projects
means separate containers, separate volumes and separate ports, so neither job can
see the other's stack. scripts/ci-linux-rehearsal.sh passes COMPOSE_PROJECT_NAME
and EDGE_PORT through to the seeding container so an operator can isolate a
rehearsal the same way.

Measured after: the same full act pass is 5 jobs succeeded, 0 failed — lint,
source (128/128, 117/117, smoke 25/0), image (261 MB, compose smoke 53/0),
console (53 assertions / 0 failed, screenshot artifact), freshness. Locally:
compose gate 53/0 with the default project and port unchanged, and the console
gate 53/0 driven through the CI configuration (COMPOSE_PROJECT_NAME=openwafci-console,
EDGE_PORT=8090).
This commit is contained in:
Pavlo Ratushnyi
2026-10-02 07:21:13 +02:00
parent 39d08eca51
commit ea68b550e2
3 changed files with 26 additions and 1 deletions
+15
View File
@@ -162,6 +162,16 @@ jobs:
# Brings up edge + nginx, waits for the image's own HEALTHCHECK, asserts
# over a socket, and tears the stack down on exit.
- name: Compose smoke — the deployed image
env:
# Its own compose project and its own host port. The console job below
# brings up the same file, and on any machine where two jobs share one
# docker daemon (a self-hosted runner, a local act run) the default
# project name and the default 8080 make them the same stack: one
# job's `compose down` is the other's connection refused. Measured, not
# guessed — see the comment in docker-compose.yml.
COMPOSE_PROJECT_NAME: openwafci-image
EDGE_PORT: "8080"
EDGE: http://127.0.0.1:8080
run: ./scripts/ci-gates.sh compose-smoke
# The console is a page, and a page fails in ways curl cannot see: a typo in
@@ -207,6 +217,11 @@ jobs:
# the runner is gone; a red one leaves the reviewer the page as it
# broke. console-check.cjs writes <path> and <path>.phone.png.
SCREENSHOT: console-evidence.png
# See the compose-smoke step: a separate project and port, so the two
# jobs cannot tear down each other's stack.
COMPOSE_PROJECT_NAME: openwafci-console
EDGE_PORT: "8090"
EDGE: http://127.0.0.1:8090
run: ./scripts/ci-gates.sh console
# always(): the failure case is the one worth looking at.
+10 -1
View File
@@ -11,7 +11,16 @@ services:
context: .
dockerfile: Dockerfile
ports:
- "8080:8080"
# The host port is a variable, not a literal. Two CI jobs that each bring
# up this file against one docker daemon otherwise fight over the same
# published port and the same project's containers — one job's teardown is
# another job's connection refused. Measured with a local Actions runner
# (act 0.2.89), where the image job and the console job share a daemon: the
# console gate died at its seeding curl with exit 7 while the image job's
# compose smoke was tearing the same project down. On GitHub's hosted
# runners each job gets its own machine, which is exactly why this never
# showed up there.
- "${EDGE_PORT:-8080}:8080"
environment:
OPENWAF_ADMIN_TOKEN: ${OPENWAF_ADMIN_TOKEN:?set OPENWAF_ADMIN_TOKEN before starting}
OpenWaf__Policy__Mode: Enforce
+1
View File
@@ -160,6 +160,7 @@ if [ "$STAGE" = all ] || [ "$STAGE" = console ]; then
-v "$DOCKER_SOCKET:/var/run/docker.sock" \
--add-host=host.docker.internal:host-gateway \
-e OPENWAF_ADMIN_TOKEN -e EDGE="$HOST_EDGE" -e SEED_ONLY=1 \
-e COMPOSE_PROJECT_NAME -e EDGE_PORT \
"$COMPOSE_IMAGE" sh -euo pipefail -c '
command -v bash >/dev/null || apk add --no-cache bash >/dev/null
command -v curl >/dev/null || apk add --no-cache curl >/dev/null