Fix CI boot check take 3: \$\$ isn't unique across job containers

Every job container's entry shell gets the same low PID, so
backend-ci-\$\$ collided with an already-stuck leftover container from
a prior run (confirmed in the runner logs: "container name already in
use"). GITHUB_RUN_ID is genuinely unique per run -- use that for both
the container name and the per-run host port instead.
This commit is contained in:
emi 2026-07-21 16:18:13 -07:00
parent b4690a0a5e
commit eff0b1ee18

View file

@ -35,14 +35,17 @@ jobs:
# failing fast) -- confirmed by a stuck run. 127.0.0.1 DOES work
# (proven by the monorepo's own build.yml, which has used a
# published host port successfully all along), so publish one, but
# to a per-run PID-derived port rather than a fixed one -- this
# runner's snap-Docker install has a known AppArmor bug denying
# docker stop/kill, so a leftover container from any prior failed
# run permanently squats whatever host port it was given, and a
# fixed port would block every subsequent run too.
# to a per-run unique port rather than a fixed one -- this runner's
# snap-Docker install has a known AppArmor bug denying docker
# stop/kill, so a leftover container from any prior failed run
# permanently squats whatever host port it was given, and a fixed
# port would block every subsequent run too. GITHUB_RUN_ID (NOT
# $$ -- every job container's shell gets the same low PID, so that
# collided with an already-stuck leftover from a prior run) is
# genuinely unique per run.
run: |
name="backend-ci-$$"
port=$((18000 + ($$ % 1000)))
name="backend-ci-${GITHUB_RUN_ID}"
port=$((18000 + (GITHUB_RUN_ID % 1000)))
docker run -d --name "$name" \
-e THERMOGRAPH_FRONTEND_BASE_INTERNAL=http://127.0.0.1:1 \
-p "127.0.0.1:${port}:8137" thermograph-backend:ci