diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f96f74a..08614e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 and .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. diff --git a/docker-compose.yml b/docker-compose.yml index 0720525..d293f80 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/scripts/ci-linux-rehearsal.sh b/scripts/ci-linux-rehearsal.sh index d2436e3..1b3c2ac 100755 --- a/scripts/ci-linux-rehearsal.sh +++ b/scripts/ci-linux-rehearsal.sh @@ -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