Fix CI DinD networking: replace host mode with compose-internal Playwright
Some checks failed
CI/CD / detect-changes (pull_request) Successful in 4s
CI/CD / test-frontend (pull_request) Successful in 6s
CI/CD / test-go-pg (pull_request) Successful in 2m44s
CI/CD / test-sqlite (pull_request) Successful in 2m48s
CI/CD / test-runners (pull_request) Failing after 2m38s
CI/CD / build-and-deploy (pull_request) Has been skipped
Some checks failed
CI/CD / detect-changes (pull_request) Successful in 4s
CI/CD / test-frontend (pull_request) Successful in 6s
CI/CD / test-go-pg (pull_request) Successful in 2m44s
CI/CD / test-sqlite (pull_request) Successful in 2m48s
CI/CD / test-runners (pull_request) Failing after 2m38s
CI/CD / build-and-deploy (pull_request) Has been skipped
The test-runners job was failing because network_mode: host puts the armature container on DinD's network namespace, unreachable from the workflow container which is on a separate bridge network. Fix: Remove host networking entirely. Add a test-runner service to the CI compose override that runs Playwright tests on the same bridge network as armature, using Docker DNS (http://armature:80). Changes: - docker-compose.ci.yml: Replace network_mode: host with healthcheck on armature + Playwright test-runner service (depends_on: healthy) - ci.yaml: Collapse 7 test-runners steps into 3 (checkout, compose up --exit-code-from test-runner, teardown)
This commit is contained in:
@@ -384,29 +384,16 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Build Docker image
|
- name: Run surface tests (compose)
|
||||||
run: docker compose -f docker-compose.yml -f docker-compose.ci.yml build
|
|
||||||
|
|
||||||
- name: Boot server (SQLite, host networking)
|
|
||||||
env:
|
env:
|
||||||
BUNDLED_PACKAGES: '*'
|
BUNDLED_PACKAGES: '*'
|
||||||
ARMATURE_ADMIN_USERNAME: admin
|
ARMATURE_ADMIN_USERNAME: admin
|
||||||
ARMATURE_ADMIN_PASSWORD: admin
|
ARMATURE_ADMIN_PASSWORD: admin
|
||||||
ARMATURE_ADMIN_EMAIL: admin@test.local
|
ARMATURE_ADMIN_EMAIL: admin@test.local
|
||||||
run: docker compose -f docker-compose.yml -f docker-compose.ci.yml up -d
|
run: |
|
||||||
|
docker compose -f docker-compose.yml -f docker-compose.ci.yml up --build \
|
||||||
- name: Wait for healthy
|
--abort-on-container-exit \
|
||||||
run: ./ci/wait-for-healthy.sh http://localhost:80 30
|
--exit-code-from test-runner
|
||||||
|
|
||||||
- name: Install Playwright
|
|
||||||
run: npx playwright install --with-deps chromium
|
|
||||||
|
|
||||||
- name: Run surface tests
|
|
||||||
env:
|
|
||||||
SERVER_URL: http://localhost:80
|
|
||||||
ADMIN_USER: admin
|
|
||||||
ADMIN_PASS: admin
|
|
||||||
run: ./ci/run-surface-tests.sh
|
|
||||||
|
|
||||||
- name: Teardown
|
- name: Teardown
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
@@ -1,7 +1,44 @@
|
|||||||
# CI override — uses host networking so the container is reachable
|
# docker-compose.ci.yml — CI test override
|
||||||
# from the Gitea runner pod without cross-network routing.
|
|
||||||
#
|
#
|
||||||
# Usage: docker compose -f docker-compose.yml -f docker-compose.ci.yml up -d
|
# Extends base docker-compose.yml. Adds a healthcheck to armature and a
|
||||||
|
# Playwright test-runner service. All containers share the default compose
|
||||||
|
# bridge network, so the test-runner reaches armature via Docker DNS
|
||||||
|
# (http://armature:80).
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# docker compose -f docker-compose.yml -f docker-compose.ci.yml up --build \
|
||||||
|
# --abort-on-container-exit --exit-code-from test-runner
|
||||||
|
#
|
||||||
|
# The workflow exits with the test-runner's exit code (0 = pass, 1 = fail).
|
||||||
|
#
|
||||||
|
# NOTE: Do NOT use network_mode: host — the workflow container and compose
|
||||||
|
# containers are in separate network namespaces inside DinD. Use the default
|
||||||
|
# bridge network and let services talk via Docker DNS instead.
|
||||||
|
|
||||||
services:
|
services:
|
||||||
armature:
|
armature:
|
||||||
network_mode: host
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-sf", "http://localhost:80/api/v1/auth/login"]
|
||||||
|
interval: 2s
|
||||||
|
timeout: 3s
|
||||||
|
retries: 30
|
||||||
|
start_period: 5s
|
||||||
|
|
||||||
|
test-runner:
|
||||||
|
image: mcr.microsoft.com/playwright:v1.52.0-noble
|
||||||
|
depends_on:
|
||||||
|
armature:
|
||||||
|
condition: service_healthy
|
||||||
|
working_dir: /work
|
||||||
|
volumes:
|
||||||
|
- .:/work
|
||||||
|
environment:
|
||||||
|
SERVER_URL: http://armature:80
|
||||||
|
ADMIN_USER: admin
|
||||||
|
ADMIN_PASS: admin
|
||||||
|
command:
|
||||||
|
- bash
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
npm install --no-save playwright 2>/dev/null
|
||||||
|
./ci/run-surface-tests.sh
|
||||||
|
|||||||
Reference in New Issue
Block a user