From 3b44059caa09c095281dc4c6be985368955d22ff Mon Sep 17 00:00:00 2001 From: Alexey Grigorev Date: Mon, 23 Nov 2026 12:35:20 +0100 Subject: [PATCH 1/4] CI: run Linux jobs on the Contabo self-hosted runner GitHub-hosted Actions minutes ran out, so the Linux jobs move to the repository's self-hosted runner on the contabo-ci VPS. Jobs that can run on a pull_request now skip for fork PRs, so untrusted code never reaches the self-hosted runner. Playwright no longer installs OS packages with sudo; the runner host has Chromium's dependencies preinstalled. Hub intake 2caf605f --- .github/workflows/deploy-dataops-v1.yml | 5 +++-- .github/workflows/sandbox-backup-evidence.yml | 6 +++--- .github/workflows/validate-backend-e2e.yml | 17 ++++++++--------- .github/workflows/validate-cli.yml | 3 ++- .github/workflows/validate-dataops-content.yml | 3 ++- .github/workflows/validate-planning-docs.yml | 3 ++- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/.github/workflows/deploy-dataops-v1.yml b/.github/workflows/deploy-dataops-v1.yml index a34682003..59787b748 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 4eb6e37f0..fb2c74338 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 ff9873a32..dbec1fdb3 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 c02259e4c..f87d75860 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 fe4012355..4f24914a9 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 be159daa8..5df9dfae0 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 From e46f6db96d4ea257a323aaed2f60f65d6793e329 Mon Sep 17 00:00:00 2001 From: Alexey Grigorev Date: Mon, 23 Nov 2026 18:31:59 +0100 Subject: [PATCH 2/4] CI: declare the contabo runner label for actionlint; assert the self-hosted Playwright install contract --- .github/actionlint.yaml | 5 +++++ tests/infra/test_template.py | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 .github/actionlint.yaml diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml new file mode 100644 index 000000000..6c6f4880e --- /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/tests/infra/test_template.py b/tests/infra/test_template.py index 7cc6eff18..532fc7111 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 From 5cdf12a5c3558a5514bb033e59578b68387584b0 Mon Sep 17 00:00:00 2001 From: Alexey Grigorev Date: Mon, 23 Nov 2026 19:00:01 +0100 Subject: [PATCH 3/4] tests: scale CPU-starvation-sensitive timing budgets for the shared 2-vCPU runner (assertions unchanged) --- backend/tests/e2e-global-setup.test.ts | 14 +++++++------- backend/tests/knowledge-backup.test.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/tests/e2e-global-setup.test.ts b/backend/tests/e2e-global-setup.test.ts index 418bce5e6..532558127 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 ca57f50e8..5a99fa258 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)); From 99b66ca0e46a0bc5dec3ffde6bfbb8f5aceb360b Mon Sep 17 00:00:00 2001 From: Alexey Grigorev Date: Mon, 23 Nov 2026 19:23:41 +0100 Subject: [PATCH 4/4] tests: retry DynamoDB Local container start only on an ephemeral host-port collision (shared CI host) --- backend/scripts/test-invoice-publication.sh | 23 +++++++++++++++++-- ...test-sponsor-communications-transaction.sh | 23 +++++++++++++++++-- .../test-sponsor-finance-transaction.sh | 23 +++++++++++++++++-- backend/scripts/test-task-card-transaction.sh | 23 +++++++++++++++++-- 4 files changed, 84 insertions(+), 8 deletions(-) diff --git a/backend/scripts/test-invoice-publication.sh b/backend/scripts/test-invoice-publication.sh index e7fb9ed41..b987717b4 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 2cf91fe71..88e590210 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 fb2c8c123..61e353e86 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 6d2532c0d..d1da1723c 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