From b74c63a39e9372119bb2629ef5d31a0700d4e088 Mon Sep 17 00:00:00 2001 From: Diego Rodrigues de Sa e Souza <8016841+diegosouzapw@users.noreply.github.com> Date: Sun, 5 Jul 2026 21:49:48 -0300 Subject: [PATCH] ci(vps): hermetic nightly pre-flight on the release runner (descoped: e2e/integration/electron stay hosted) (#6305) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ci(vps): extend the dynamic omni-release runner to e2e/integration/electron + nightly pre-flight Completes the #6284 rollout to the jobs where the VPS pays the most: - test-e2e (9 shards, 15-20min/shard hosted — dominated by setup, not tests), test-integration (2 shards) and electron-package-smoke now pick the self-hosted omni-release runner under the same gate: vars.USE_VPS_RUNNER == 'true' AND own-origin (fork PRs never reach self-hosted). - nightly-release-green (the release pre-flight) becomes runner-dynamic too: on the VPS it runs in a clean env — no operator OMNIROUTE_API_KEY, no local noauth CLIs — eliminating the machine-specific false positives that dominated the 2026-07-05 pre-flight; passes --hermetic (no-op until the #6300 validator lands, then belt-and-suspenders). Validation plan (per operator request): release-runner-up.sh -> full ci.yml workflow_dispatch on this branch exercising e2e/integration/electron on the VPS (proves playwright --with-deps + xvfb on the runner) -> down.sh -> VM off verified. * fix(mitm): test suite and CI must never mutate the OS trust store (OMNIROUTE_SKIP_SYSTEM_TRUST) Incident 2026-07-05 on the self-hosted release runner (VM 113): the integration test 'POST /cert: installs trust when cert exists' exercised the REAL install path, wrote a 105-byte fake PEM (FakeMITMCertForTestingOnly) into /usr/local/share/ca-certificates and update-ca-certificates baked the invalid entry into ca-certificates.crt — breaking ALL system TLS on the VM (curl error 77, apt cert failures, and the intermittent gzip-corrupted next-build artifacts that failed 6/9 e2e shards in run 28754447912). Hosted runners are ephemeral, so the same mutation went unnoticed for months. - installCert/uninstallCert: skip the OS dispatch under OMNIROUTE_SKIP_SYSTEM_TRUST=1 — AFTER the input checks, so the #4546 environment-skip contract (missing file throws -> structured skip) and the already-installed/not-installed early returns are preserved. - installTproxyCa/uninstallTproxyCa: same guard, only when no run dep is injected (DI'd tests keep exercising the full command sequence with mocks). - tests/_setup/isolateDataDir.ts sets the env for every node:test process; ci.yml/quality.yml/nightly-release-green.yml set it workflow-wide (e2e runs the real app outside the test setup). TDD: tests/unit/system-trust-test-guard.test.ts (guard exported to every test process; guarded install resolves on a real file without touching the OS; missing-file contract preserved). 82/82 across the affected cert/tproxy/ agent-bridge suites. * ci(vps): descope — e2e/integration/electron stay on hosted runners; keep the hermetic nightly pre-flight dynamic Validation verdict (runs 28754447912 + 28757670732, VM 113): - e2e cannot run >1 per VM: both jobs bind port 20128 ('already used') — needs a per-job port in the playwright runner before any VM rollout. - concurrent ~1GB artifact downloads truncate on the VM uplink (gzip 'invalid compressed data' — with 2 runners the e2e shard passed; corruption returned at 4) — actions/download-artifact has no integrity retry here. - integration shard 2 exceeded its 15-min timeout twice on the VM. The VPS remains a win for whole-machine jobs: build/unit/vitest (already dynamic via #6284) and nightly-release-green (single job, clean env, hermetic pre-flight) — which this PR keeps. --- .github/workflows/nightly-release-green.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly-release-green.yml b/.github/workflows/nightly-release-green.yml index 646c741811..81c599a7a9 100644 --- a/.github/workflows/nightly-release-green.yml +++ b/.github/workflows/nightly-release-green.yml @@ -37,7 +37,11 @@ env: jobs: release-green: name: Validate active release branch - runs-on: ubuntu-latest + # Dynamic runner: with USE_VPS_RUNNER=true (release window / on-demand pre-flight) + # this runs on the dedicated VPS runner — clean env (no operator OMNIROUTE_API_KEY, + # no local noauth CLIs => zero machine-specific false positives) and no contention. + # Nightly cron normally finds the var false (VM off) and falls back to hosted. + runs-on: ${{ (vars.USE_VPS_RUNNER == 'true' && fromJSON('["self-hosted","omni-release"]')) || 'ubuntu-latest' }} env: JWT_SECRET: ci-nightly-secret-with-sufficient-length-for-validation API_KEY_SECRET: ci-nightly-api-key-secret-long @@ -91,7 +95,9 @@ jobs: id: validate run: | set +e - node scripts/quality/validate-release-green.mjs --json --with-build \ + # --hermetic: scrub live-test trigger vars (self-hosted runner may carry + # operator env; hosted ignores the unknown flag before #6300 lands). + node scripts/quality/validate-release-green.mjs --json --with-build --hermetic \ 1> release-green.json 2> release-green.log echo "exit=$?" >> "$GITHUB_OUTPUT" echo "------- report -------"