fix(ci): use --network host for Mongo + add diagnostics
Some checks failed
Test / vitest (push) Successful in 11m11s
Test / playwright (push) Failing after 7m21s
Test / visual (push) Failing after 7m40s
Test / Notify on failure (push) Successful in 2s

Wait-for-Mongo timed out at 30s after Start-MongoDB succeeded — typical
Docker-in-Docker symptom where -p port mapping binds to a network the
runner's node process can't see. --network host puts Mongo in the
runner's network namespace so localhost:27017 reaches it.

Also dump 'docker ps' after start and 'docker logs mongo-ci' on failure
so the next-step debugging isn't blind.
This commit is contained in:
Jennie Robinson Faber 2026-05-01 07:36:11 +01:00
parent a797f8e17c
commit 386cb7e4b2

View file

@ -39,9 +39,14 @@ jobs:
- run: npm ci - run: npm ci
- run: npx playwright install --with-deps chromium - run: npx playwright install --with-deps chromium
- name: Start MongoDB - name: Start MongoDB
run: docker run -d --name mongo-ci -p 27017:27017 mongo:7 run: |
docker run -d --name mongo-ci --network host mongo:7
docker ps
- name: Wait for MongoDB - name: Wait for MongoDB
run: timeout 30 sh -c 'until nc -z localhost 27017; do sleep 1; done' run: timeout 30 sh -c 'until nc -z localhost 27017; do sleep 1; done'
- name: MongoDB log on failure
if: failure()
run: docker logs mongo-ci || true
- run: npm run build - run: npm run build
- name: Start server - name: Start server
run: node .output/server/index.mjs > /tmp/server.log 2>&1 & run: node .output/server/index.mjs > /tmp/server.log 2>&1 &
@ -96,9 +101,14 @@ jobs:
- run: npm ci - run: npm ci
- run: npx playwright install --with-deps chromium - run: npx playwright install --with-deps chromium
- name: Start MongoDB - name: Start MongoDB
run: docker run -d --name mongo-ci -p 27017:27017 mongo:7 run: |
docker run -d --name mongo-ci --network host mongo:7
docker ps
- name: Wait for MongoDB - name: Wait for MongoDB
run: timeout 30 sh -c 'until nc -z localhost 27017; do sleep 1; done' run: timeout 30 sh -c 'until nc -z localhost 27017; do sleep 1; done'
- name: MongoDB log on failure
if: failure()
run: docker logs mongo-ci || true
- run: npm run build - run: npm run build
- name: Start server - name: Start server
run: node .output/server/index.mjs > /tmp/server.log 2>&1 & run: node .output/server/index.mjs > /tmp/server.log 2>&1 &