diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml new file mode 100644 index 00000000..6c6f4880 --- /dev/null +++ b/.github/actionlint.yaml @@ -0,0 +1,5 @@ +# Self-hosted runner labels used by the workflows (Contabo CI host). Without this, +# actionlint rejects `runs-on: [self-hosted, contabo]` as an unknown label. +self-hosted-runner: + labels: + - contabo diff --git a/.github/workflows/deploy-dataops-v1.yml b/.github/workflows/deploy-dataops-v1.yml index a3468200..59787b74 100644 --- a/.github/workflows/deploy-dataops-v1.yml +++ b/.github/workflows/deploy-dataops-v1.yml @@ -45,8 +45,9 @@ env: jobs: checks: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository name: Check DataOps v1 app - runs-on: ubuntu-24.04 + runs-on: [self-hosted, contabo] timeout-minutes: 60 steps: @@ -110,7 +111,7 @@ jobs: concurrency: group: dataops-v1-deploy cancel-in-progress: false - runs-on: ubuntu-24.04 + runs-on: [self-hosted, contabo] needs: checks permissions: contents: read diff --git a/.github/workflows/sandbox-backup-evidence.yml b/.github/workflows/sandbox-backup-evidence.yml index 4eb6e37f..fb2c7433 100644 --- a/.github/workflows/sandbox-backup-evidence.yml +++ b/.github/workflows/sandbox-backup-evidence.yml @@ -25,8 +25,8 @@ env: jobs: validate: name: Validate backup evidence workflow - if: github.event_name == 'pull_request' - runs-on: ubuntu-24.04 + if: (github.event_name == 'pull_request') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) + runs-on: [self-hosted, contabo] steps: - uses: actions/checkout@v6 - name: Check workflow syntax and shell @@ -35,7 +35,7 @@ jobs: evidence: if: github.event_name == 'workflow_dispatch' name: Read alarm state and worker config - runs-on: ubuntu-24.04 + runs-on: [self-hosted, contabo] timeout-minutes: 10 permissions: contents: read diff --git a/.github/workflows/validate-backend-e2e.yml b/.github/workflows/validate-backend-e2e.yml index ff9873a3..dbec1fdb 100644 --- a/.github/workflows/validate-backend-e2e.yml +++ b/.github/workflows/validate-backend-e2e.yml @@ -34,8 +34,9 @@ concurrency: jobs: browser-e2e: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository name: Validate backend browser flows - runs-on: ubuntu-24.04 + runs-on: [self-hosted, contabo] timeout-minutes: 45 env: DTC_AUTH_HOME: ${{ github.workspace }}/.tmp/shared-auth @@ -61,23 +62,21 @@ jobs: - name: Install Node workspace dependencies run: npm ci - # Runner apt mirrors and DNS fail transiently ("Temporary failure - # resolving archive.ubuntu.com", then "no installation candidate"). - # apt retries each fetch, and the whole install (apt-get update, the - # OS packages, and the browser download) is retried with backoff. - # Only this setup step is retried; the E2E step below runs once. + # The self-hosted runner has no sudo; Chromium's OS dependencies are + # installed on the runner host once (playwright install-deps chromium). + # The browser download is retried with backoff because network fetches + # fail transiently. Only this setup step is retried; the E2E step below + # runs once. - name: Install backend Playwright Chromium timeout-minutes: 20 run: | - printf 'Acquire::Retries "5";\nAcquire::http::Timeout "30";\nAcquire::https::Timeout "30";\n' \ - | sudo tee /etc/apt/apt.conf.d/80-ci-retries >/dev/null delays=(0 15 30 60 120) for attempt in "${!delays[@]}"; do if (( attempt > 0 )); then echo "::warning::Playwright install attempt ${attempt} failed; retrying in ${delays[$attempt]}s" sleep "${delays[$attempt]}" fi - if npm exec --workspace dataops-backend -- playwright install --with-deps chromium; then + if npm exec --workspace dataops-backend -- playwright install chromium; then exit 0 fi done diff --git a/.github/workflows/validate-cli.yml b/.github/workflows/validate-cli.yml index c02259e4..f87d7586 100644 --- a/.github/workflows/validate-cli.yml +++ b/.github/workflows/validate-cli.yml @@ -26,8 +26,9 @@ permissions: jobs: cli: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository name: CLI unit and end-to-end tests - runs-on: ubuntu-24.04 + runs-on: [self-hosted, contabo] timeout-minutes: 20 steps: diff --git a/.github/workflows/validate-dataops-content.yml b/.github/workflows/validate-dataops-content.yml index fe401235..4f24914a 100644 --- a/.github/workflows/validate-dataops-content.yml +++ b/.github/workflows/validate-dataops-content.yml @@ -30,8 +30,9 @@ permissions: jobs: validate-content: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository name: Validate operation docs content - runs-on: ubuntu-24.04 + runs-on: [self-hosted, contabo] steps: - name: Check out repository diff --git a/.github/workflows/validate-planning-docs.yml b/.github/workflows/validate-planning-docs.yml index be159daa..5df9dfae 100644 --- a/.github/workflows/validate-planning-docs.yml +++ b/.github/workflows/validate-planning-docs.yml @@ -52,8 +52,9 @@ permissions: jobs: validate-planning-docs: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository name: Validate planning and process docs - runs-on: ubuntu-24.04 + runs-on: [self-hosted, contabo] steps: - name: Check out repository diff --git a/backend/scripts/test-invoice-publication.sh b/backend/scripts/test-invoice-publication.sh index e7fb9ed4..b987717b 100755 --- a/backend/scripts/test-invoice-publication.sh +++ b/backend/scripts/test-invoice-publication.sh @@ -13,11 +13,30 @@ trap cleanup EXIT trap 'exit 130' INT trap 'exit 143' TERM -container_id="$(docker run --detach --rm \ +# Docker picks the ephemeral host port. On the shared self-hosted CI host another job can take it +# between selection and bind ("address already in use"); only that startup collision is retried. +docker_err="$(mktemp)" +started="" +for start_attempt in 1 2 3 4 5 6; do + if started="$(docker run --detach --rm \ --publish 127.0.0.1::8000 \ --name "$container_name" \ amazon/dynamodb-local:latest \ - -jar DynamoDBLocal.jar -inMemory -sharedDb)" + -jar DynamoDBLocal.jar -inMemory -sharedDb 2>"$docker_err")"; then + break + fi + if grep -q "address already in use" "$docker_err" && [ "$start_attempt" -lt 6 ]; then + echo "docker port collision starting $container_name (attempt $start_attempt); retrying" >&2 + docker rm -f "$container_name" >/dev/null 2>&1 || true + sleep "$start_attempt" + continue + fi + cat "$docker_err" >&2 + rm -f "$docker_err" + exit 1 +done +rm -f "$docker_err" +container_id="$started" mapping="$(docker port "$container_id" 8000/tcp)" if [[ ! "$mapping" =~ ^127\.0\.0\.1:[0-9]+$ ]]; then diff --git a/backend/scripts/test-sponsor-communications-transaction.sh b/backend/scripts/test-sponsor-communications-transaction.sh index 2cf91fe7..88e59021 100755 --- a/backend/scripts/test-sponsor-communications-transaction.sh +++ b/backend/scripts/test-sponsor-communications-transaction.sh @@ -13,11 +13,30 @@ trap cleanup EXIT trap 'exit 130' INT trap 'exit 143' TERM -container_id="$(docker run --detach --rm \ +# Docker picks the ephemeral host port. On the shared self-hosted CI host another job can take it +# between selection and bind ("address already in use"); only that startup collision is retried. +docker_err="$(mktemp)" +started="" +for start_attempt in 1 2 3 4 5 6; do + if started="$(docker run --detach --rm \ --publish 127.0.0.1::8000 \ --name "$container_name" \ amazon/dynamodb-local:latest \ - -jar DynamoDBLocal.jar -inMemory -sharedDb)" + -jar DynamoDBLocal.jar -inMemory -sharedDb 2>"$docker_err")"; then + break + fi + if grep -q "address already in use" "$docker_err" && [ "$start_attempt" -lt 6 ]; then + echo "docker port collision starting $container_name (attempt $start_attempt); retrying" >&2 + docker rm -f "$container_name" >/dev/null 2>&1 || true + sleep "$start_attempt" + continue + fi + cat "$docker_err" >&2 + rm -f "$docker_err" + exit 1 +done +rm -f "$docker_err" +container_id="$started" mapping="$(docker port "$container_id" 8000/tcp)" if [[ ! "$mapping" =~ ^127\.0\.0\.1:[0-9]+$ ]]; then diff --git a/backend/scripts/test-sponsor-finance-transaction.sh b/backend/scripts/test-sponsor-finance-transaction.sh index fb2c8c12..61e353e8 100755 --- a/backend/scripts/test-sponsor-finance-transaction.sh +++ b/backend/scripts/test-sponsor-finance-transaction.sh @@ -13,11 +13,30 @@ trap cleanup EXIT trap 'exit 130' INT trap 'exit 143' TERM -container_id="$(docker run --detach --rm \ +# Docker picks the ephemeral host port. On the shared self-hosted CI host another job can take it +# between selection and bind ("address already in use"); only that startup collision is retried. +docker_err="$(mktemp)" +started="" +for start_attempt in 1 2 3 4 5 6; do + if started="$(docker run --detach --rm \ --publish 127.0.0.1::8000 \ --name "$container_name" \ amazon/dynamodb-local:latest \ - -jar DynamoDBLocal.jar -inMemory -sharedDb)" + -jar DynamoDBLocal.jar -inMemory -sharedDb 2>"$docker_err")"; then + break + fi + if grep -q "address already in use" "$docker_err" && [ "$start_attempt" -lt 6 ]; then + echo "docker port collision starting $container_name (attempt $start_attempt); retrying" >&2 + docker rm -f "$container_name" >/dev/null 2>&1 || true + sleep "$start_attempt" + continue + fi + cat "$docker_err" >&2 + rm -f "$docker_err" + exit 1 +done +rm -f "$docker_err" +container_id="$started" mapping="$(docker port "$container_id" 8000/tcp)" if [[ ! "$mapping" =~ ^127\.0\.0\.1:[0-9]+$ ]]; then diff --git a/backend/scripts/test-task-card-transaction.sh b/backend/scripts/test-task-card-transaction.sh index 6d2532c0..d1da1723 100755 --- a/backend/scripts/test-task-card-transaction.sh +++ b/backend/scripts/test-task-card-transaction.sh @@ -13,12 +13,31 @@ trap cleanup EXIT trap 'exit 130' INT trap 'exit 143' TERM -container_id="$(docker run --detach --rm \ +# Docker picks the ephemeral host port. On the shared self-hosted CI host another job can take it +# between selection and bind ("address already in use"); only that startup collision is retried. +docker_err="$(mktemp)" +started="" +for start_attempt in 1 2 3 4 5 6; do + if started="$(docker run --detach --rm \ --cpus=1 \ --publish 127.0.0.1::8000 \ --name "$container_name" \ amazon/dynamodb-local:latest \ - -jar DynamoDBLocal.jar -inMemory -sharedDb)" + -jar DynamoDBLocal.jar -inMemory -sharedDb 2>"$docker_err")"; then + break + fi + if grep -q "address already in use" "$docker_err" && [ "$start_attempt" -lt 6 ]; then + echo "docker port collision starting $container_name (attempt $start_attempt); retrying" >&2 + docker rm -f "$container_name" >/dev/null 2>&1 || true + sleep "$start_attempt" + continue + fi + cat "$docker_err" >&2 + rm -f "$docker_err" + exit 1 +done +rm -f "$docker_err" +container_id="$started" mapping="$(docker port "$container_id" 8000/tcp)" if [[ ! "$mapping" =~ ^127\.0\.0\.1:[0-9]+$ ]]; then diff --git a/backend/tests/e2e-global-setup.test.ts b/backend/tests/e2e-global-setup.test.ts index 418bce5e..53255812 100644 --- a/backend/tests/e2e-global-setup.test.ts +++ b/backend/tests/e2e-global-setup.test.ts @@ -256,9 +256,9 @@ describe('Playwright E2E bootstrap', () => { const port = await listen(server); try { await assert.rejects( - globalSetupModule.waitForServer(port, 40, { + globalSetupModule.waitForServer(port, 400, { pollIntervalMs: 1, - requestTimeoutMs: 30, + requestTimeoutMs: 300, }), (error: Error) => { assert.match(error.message, /last non-timeout probe: HTTP 503/); @@ -303,7 +303,7 @@ describe('Playwright E2E bootstrap', () => { token: OWNER_TOKEN, })); await assert.rejects( - globalSetupModule.waitForOwnedServer(child, port, 100, { + globalSetupModule.waitForOwnedServer(child, port, 2000, { checkout: OWNER_CHECKOUT, token: OWNER_TOKEN, }), @@ -323,7 +323,7 @@ describe('Playwright E2E bootstrap', () => { token: OWNER_TOKEN, })); await assert.rejects( - globalSetupModule.waitForOwnedServer(child, port, 100, { + globalSetupModule.waitForOwnedServer(child, port, 2000, { checkout: OWNER_CHECKOUT, token: OWNER_TOKEN, }), @@ -346,7 +346,7 @@ describe('Playwright E2E bootstrap', () => { token: OWNER_TOKEN, })); await assert.rejects( - globalSetupModule.waitForOwnedServer(child, port, 100, { + globalSetupModule.waitForOwnedServer(child, port, 2000, { checkout: OWNER_CHECKOUT, token: OWNER_TOKEN, }), @@ -361,7 +361,7 @@ describe('Playwright E2E bootstrap', () => { const child = fakeOwnedChild(); child.exitCode = 1; await assert.rejects( - globalSetupModule.waitForOwnedServer(child, 3210, 100, { + globalSetupModule.waitForOwnedServer(child, 3210, 2000, { checkout: OWNER_CHECKOUT, token: OWNER_TOKEN, }), @@ -372,7 +372,7 @@ describe('Playwright E2E bootstrap', () => { it('requires cryptographic ownership proof before readiness can start', () => { const child = fakeOwnedChild(); assert.throws( - () => globalSetupModule.waitForOwnedServer(child, 0, 100, { + () => globalSetupModule.waitForOwnedServer(child, 0, 2000, { checkout: OWNER_CHECKOUT, token: 'not-a-generated-run-token', }), diff --git a/backend/tests/knowledge-backup.test.ts b/backend/tests/knowledge-backup.test.ts index ca57f50e..5a99fa25 100644 --- a/backend/tests/knowledge-backup.test.ts +++ b/backend/tests/knowledge-backup.test.ts @@ -14,7 +14,7 @@ it('streams a large historical repository within a 256 MiB RSS bound',async()=>{ // minimum of three runs; real retention raises every run's peak. const measured:{uploaded:number;maxRssBytes:number}[]=[]; for(let attempt=0;attempt<3;attempt++){ - const {stdout}=await promisify(execFile)('/bin/sh',['-c','"$@"; result=$?; exit "$result"','knowledge-memory',process.execPath,'--max-old-space-size=64','--max-semi-space-size=1','--import','tsx',require.resolve('./helpers/knowledge-backup-memory.ts')],{timeout:120_000}); + const {stdout}=await promisify(execFile)('/bin/sh',['-c','"$@"; result=$?; exit "$result"','knowledge-memory',process.execPath,'--max-old-space-size=64','--max-semi-space-size=1','--import','tsx',require.resolve('./helpers/knowledge-backup-memory.ts')],{timeout:600_000}); measured.push(JSON.parse(stdout.trim())); } assert.ok(measured.every((m)=>m.uploaded>256*1024*1024)); diff --git a/tests/infra/test_template.py b/tests/infra/test_template.py index 7cc6eff1..532fc711 100644 --- a/tests/infra/test_template.py +++ b/tests/infra/test_template.py @@ -748,10 +748,14 @@ def test_browser_e2e_is_visible_but_cannot_block_or_queue_deployment(): assert "cancel-in-progress: true" not in e2e_workflow assert "Tested commit:" in e2e_workflow assert "timeout-minutes: 45" in e2e_workflow - assert "playwright install --with-deps chromium" in e2e_workflow - # A single runner apt/DNS outage must not fail the job: apt retries each - # fetch and the whole Playwright install is retried with backoff. - assert 'Acquire::Retries "5"' in e2e_workflow + # Self-hosted Contabo runner: no sudo, so `--with-deps` (apt) cannot run. The OS + # libraries are installed on the host once; the job only downloads Chromium. + assert "runs-on: [self-hosted, contabo]" in e2e_workflow + assert "playwright install chromium" in e2e_workflow + assert "--with-deps" not in e2e_workflow + assert "playwright install-deps chromium" in e2e_workflow # documented host prerequisite + # A transient network failure must not fail the job: the whole Playwright + # browser download is retried with backoff. assert "delays=(0 15 30 60 120)" in e2e_workflow assert "npm --prefix backend run test:e2e" in e2e_workflow assert "if: failure()" in e2e_workflow