diff --git a/.forgejo/workflows/deploy-prod.yml b/.forgejo/workflows/deploy-prod.yml index f9f5284..8a8944a 100644 --- a/.forgejo/workflows/deploy-prod.yml +++ b/.forgejo/workflows/deploy-prod.yml @@ -12,6 +12,7 @@ on: jobs: validate: runs-on: docker + container: "mcr.microsoft.com/playwright:v1.62.1-noble@sha256:dcc5531e97840b9b5e794f2814476b21571c5124a3fca2267d73041f56e7580e" outputs: commit: ${{ steps.commit.outputs.sha }} @@ -50,9 +51,6 @@ jobs: - name: Install dependencies from the lockfile run: npm ci - - name: Install the Chromium test runtime - run: npx playwright install --with-deps chromium - - name: Run the complete validation gate run: npm run check:full diff --git a/.forgejo/workflows/validate-main.yml b/.forgejo/workflows/validate-main.yml index 572ef8d..c0fdd5a 100644 --- a/.forgejo/workflows/validate-main.yml +++ b/.forgejo/workflows/validate-main.yml @@ -9,6 +9,7 @@ on: jobs: validate: runs-on: docker + container: "mcr.microsoft.com/playwright:v1.62.1-noble@sha256:dcc5531e97840b9b5e794f2814476b21571c5124a3fca2267d73041f56e7580e" steps: - name: Check out the pushed commit @@ -29,8 +30,5 @@ jobs: - name: Install dependencies from the lockfile run: npm ci - - name: Install the Chromium test runtime - run: npx playwright install --with-deps chromium - - name: Run the complete validation gate run: npm run check:full diff --git a/docs/DELIVERY.md b/docs/DELIVERY.md index f874ec9..9ea3315 100644 --- a/docs/DELIVERY.md +++ b/docs/DELIVERY.md @@ -24,6 +24,12 @@ La validation utilise Node 24.11.1, npm 11.17.x, `npm ci` et `package.json` et `package-lock.json`. Elle n'ouvre aucune connexion vers le serveur de production. +Le label historique `docker` du runner utilise Debian 11, qui n'est plus pris +en charge par Playwright 1.62.1. Les jobs de validation remplacent explicitement +cette base par l'image officielle `playwright:v1.62.1-noble`, fixée par digest. +Elle fournit Chromium et ses dépendances sous Ubuntu 24.04 ; sa version doit +rester identique à celle de `@playwright/test` dans le lockfile. + ## Accès SSH Le job de livraison exige deux secrets Forgejo : diff --git a/tests/deployment-workflow.test.mjs b/tests/deployment-workflow.test.mjs index 208b628..b8ed00b 100644 --- a/tests/deployment-workflow.test.mjs +++ b/tests/deployment-workflow.test.mjs @@ -6,6 +6,7 @@ import { test } from "node:test"; import { promisify } from "node:util"; const deployWorkflowPath = ".forgejo/workflows/deploy-prod.yml"; +const packageLockPath = "package-lock.json"; const remoteScriptPath = "scripts/deploy-sokko-g.sh"; const servicePath = "ops/systemd/sokko-g.service"; const validationWorkflowPath = ".forgejo/workflows/validate-main.yml"; @@ -16,6 +17,7 @@ test("main pushes run the complete gate without access to deployment secrets", a assert.match(workflow, /push:\s+[\s\S]*branches:\s+[\s\S]*- main/); assert.match(workflow, /ref: \$\{\{ gitea\.sha \}\}/); + assert.match(workflow, /container: "mcr\.microsoft\.com\/playwright:v1\.62\.1-noble@sha256:[0-9a-f]{64}"/); assert.match(workflow, /npm ci/); assert.match(workflow, /npm run check:full/); assert.doesNotMatch(workflow, /workflow_dispatch:/); @@ -30,6 +32,7 @@ test("production deployment requires a validated exact commit and pinned SSH hos assert.doesNotMatch(workflow, /push:/); assert.match(workflow, /REQUESTED_COMMIT[\s\S]*\^\[0-9a-f\]\{40\}\$/); assert.match(workflow, /deploy:\s+[\s\S]*needs: validate/); + assert.match(workflow, /validate:\s+[\s\S]*container: "mcr\.microsoft\.com\/playwright:v1\.62\.1-noble@sha256:[0-9a-f]{64}"/); assert.match(workflow, /npm ci/); assert.match(workflow, /npm run check:full/); assert.match(workflow, /git merge-base --is-ancestor "\$commit" origin\/main/); @@ -45,6 +48,22 @@ test("production deployment requires a validated exact commit and pinned SSH hos assert.doesNotMatch(workflow, /\$\{\{\s*forgejo\./); }); +test("validation containers match the locked Playwright release", async () => { + const [lockContents, validationWorkflow, deployWorkflow] = await Promise.all([ + readFile(packageLockPath, "utf8"), + readFile(validationWorkflowPath, "utf8"), + readFile(deployWorkflowPath, "utf8") + ]); + const lock = JSON.parse(lockContents); + const playwrightVersion = lock.packages["node_modules/@playwright/test"].version; + const expectedImage = `mcr.microsoft.com/playwright:v${playwrightVersion}-noble@sha256:`; + + assert.ok(validationWorkflow.includes(expectedImage)); + assert.ok(deployWorkflow.includes(expectedImage)); + assert.doesNotMatch(validationWorkflow, /playwright install --with-deps/); + assert.doesNotMatch(deployWorkflow, /playwright install --with-deps/); +}); + test("the versioned remote script builds and activates only the requested commit", async () => { await execFileAsync("bash", ["-n", remoteScriptPath]); const script = await readFile(remoteScriptPath, "utf8");