fix(ci): migrations job — postgres service alias, not localhost #201

Merged
amiryahaya merged 2 commits from fix/ci-migrations-service-host into main 2026-11-14 04:13:58 +01:00
Owner

Fixes the migrations job failure introduced with #196's CI leg (failed on #200's head and on main).

Root cause: Forgejo act_runner runs ubuntu-latest jobs as docker://forgejo-fix/node:20-bullseye containers — inside the job container, localhost:5432 is the job container itself. The postgres service container is reachable by its network alias (postgres). GitHub's VM runners are the other world, where localhost works — runner journal confirmed the service was created and cleaned up correctly on our runners.

Fix: Npgsql multi-host failover — Host=postgres,localhost tries the alias first, localhost second. Works in both worlds.

Process note: this reached main because the merge gate poll matched runs by TITLE prefix — the second push to #200 retitled its runs (feat(admin): …), so the poll kept reading the stale-success run from the first push while the real head run (13006) failed. Merge-gate polling now matches by SHA (this PR's runs are watched by git rev-parse HEAD), and the rule is: title prefixes are cosmetic, SHAs are identity.

Fixes the `migrations` job failure introduced with #196's CI leg (failed on #200's head and on main). **Root cause:** Forgejo act_runner runs `ubuntu-latest` jobs as `docker://forgejo-fix/node:20-bullseye` **containers** — inside the job container, `localhost:5432` is the job container itself. The postgres **service** container is reachable by its network alias (`postgres`). GitHub's VM runners are the other world, where localhost works — runner journal confirmed the service was created and cleaned up correctly on our runners. **Fix:** Npgsql multi-host failover — `Host=postgres,localhost` tries the alias first, localhost second. Works in both worlds. **Process note:** this reached main because the merge gate poll matched runs by TITLE prefix — the second push to #200 retitled its runs (`feat(admin): …`), so the poll kept reading the stale-success run from the first push while the real head run (13006) failed. Merge-gate polling now matches by SHA (this PR's runs are watched by `git rev-parse HEAD`), and the rule is: title prefixes are cosmetic, SHAs are identity.
fix(ci): migrations job — reach the postgres service via its alias, not localhost
Some checks failed
API CI / migrations (pull_request) Failing after 1m39s
Security CI / security-scan (pull_request) Successful in 2m41s
API CI / build-and-test (pull_request) Successful in 7m57s
e7c1fc4540
The migrations job failed on both #200 and main: on Forgejo act_runner
with docker:// job images the job runs INSIDE a container, where
localhost:5432 is the job container itself — the service container is
reachable by its network alias (postgres), unlike GitHub's VM runners
where localhost works. Npgsql multi-host failover (Host=postgres,
localhost) covers both worlds.

Runner journal confirms services were created and cleaned up for the
job; no postgres container lingered after cleanup.
fix(ci): migrations job — drop services:, share the job netns via docker
All checks were successful
API CI / migrations (pull_request) Successful in 1m43s
Security CI / security-scan (pull_request) Successful in 2m32s
API CI / build-and-test (pull_request) Successful in 6m25s
b5601769a6
Round 2: Host=postgres (service alias) also failed — act_runner's
service networking is not dependable on this fleet. The job containers
mount the host docker socket (#146 finding F1), so start postgres with
--network container:$(hostname): it shares the job container's network
namespace, listens on the job's own loopback, and Host=127.0.0.1 is
exact — no alias, no port publishing, no services: block. pg_isready
via docker exec; always() cleanup.
Sign in to join this conversation.
No description provided.