diff --git a/.gitea/workflows/quality-gates.yml b/.gitea/workflows/quality-gates.yml index 4c3f9173..4898c239 100644 --- a/.gitea/workflows/quality-gates.yml +++ b/.gitea/workflows/quality-gates.yml @@ -237,6 +237,8 @@ jobs: if: ${{ startsWith(gitea.ref, 'refs/tags/v') || (gitea.event_name == 'workflow_dispatch' && (inputs.stage == 'release' || inputs.stage == 'production' || inputs.stage == 'field')) }} runs-on: ubuntu-latest timeout-minutes: 45 + env: + RELEASE_TAG: "${{ startsWith(gitea.ref, 'refs/tags/v') && gitea.ref_name || '' }}" strategy: fail-fast: false matrix: diff --git a/config/ci/gates.json b/config/ci/gates.json index 360c1185..594c173d 100644 --- a/config/ci/gates.json +++ b/config/ci/gates.json @@ -1993,6 +1993,9 @@ "commandIds": [ "review-a11y-manual" ], + "requiresEnvironment": [ + "RELEASE_TAG" + ], "logArtifactId": "artifact-artifacts-quality-gates-FE-GATE-028-txt", "evidenceArtifactIds": [ "artifact-docs-accessibility-route-reviews-APP-HOME-md", @@ -2291,7 +2294,12 @@ "browserGateIds": [ "FE-GATE-026" ], - "environment": [], + "environment": [ + { + "name": "RELEASE_TAG", + "value": "${{ startsWith(gitea.ref, 'refs/tags/v') && gitea.ref_name || '' }}" + } + ], "steps": [ { "kind": "checkout" diff --git a/docs/operations/ci-quality-gates.md b/docs/operations/ci-quality-gates.md index 50bea937..7c7ab0f4 100644 --- a/docs/operations/ci-quality-gates.md +++ b/docs/operations/ci-quality-gates.md @@ -148,6 +148,10 @@ full commit ID와 commit timestamp를 한 번 읽어 `SOURCE_DATE_EPOCH`를 유 release manifest도 같은 build ID, commit SHA, release ID와 timestamp를 가져야 한다. +`release_gate` job은 tag run이면 그 tag 이름(예 `v1.4.0`)을 `RELEASE_TAG`로 준다. +FE-GATE-028이 이 값을 요구한다(`requiresEnvironment`). tag run이 아니면(브랜치에서 수동으로 +돌린 release 단계) 값이 비어 게이트가 `missing required environment: RELEASE_TAG`로 실패한다. + Release tier의 `immutable_build`는 `dist`의 hidden `.vite` entries, raw `pnpm-lock.yaml`, build/module inventory와 local release/security evidence를 한 번 생성해 run ID/attempt로 구분된 archive로 게시한다. Raw lock bytes의 SHA-256은 diff --git a/scripts/contracts/ci-gates.ts b/scripts/contracts/ci-gates.ts index d8b361d3..71499d29 100644 --- a/scripts/contracts/ci-gates.ts +++ b/scripts/contracts/ci-gates.ts @@ -991,7 +991,13 @@ function validateContractSemantics( merge_static: [], merge_test: [], merge_browser: [], - release_gate: [], + release_gate: [ + // 1112/05-01 (R9-D7, release tag). FE-GATE-028 compares each signed + // record's Release ID with the tag being released. A run that is not a + // tag run (a release stage dispatched on a branch) gets an empty value, + // and run-ci-gate.ts fails the gate on it. + { name: "RELEASE_TAG", value: "${{ startsWith(gitea.ref, 'refs/tags/v') && gitea.ref_name || '' }}" }, + ], immutable_build: [ // FE-GATE-027 admits the built artifact to a named environment, so both // the profile it was built from and the destination it is claimed for are diff --git a/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap b/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap index 89642a65..c5c3eb7a 100644 --- a/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap +++ b/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap @@ -240,6 +240,8 @@ jobs: if: \${{ startsWith(gitea.ref, 'refs/tags/v') || (gitea.event_name == 'workflow_dispatch' && (inputs.stage == 'release' || inputs.stage == 'production' || inputs.stage == 'field')) }} runs-on: ubuntu-latest timeout-minutes: 45 + env: + RELEASE_TAG: "\${{ startsWith(gitea.ref, 'refs/tags/v') && gitea.ref_name || '' }}" strategy: fail-fast: false matrix: diff --git a/tests/unit/ci-workflow-generation.test.ts b/tests/unit/ci-workflow-generation.test.ts index 84055d56..0e67e3c3 100644 --- a/tests/unit/ci-workflow-generation.test.ts +++ b/tests/unit/ci-workflow-generation.test.ts @@ -242,6 +242,27 @@ describe("CI gate contract", () => { expect(stageOf("FE-GATE-028")).toBe("release"); }); + // 1112/05-01 (R9-D7). The signed review names the release tag it covers; + // the release job hands FE-GATE-028 that tag, and nothing on a run that is + // not a tag run, so the gate fails closed there (run-ci-gate.ts refuses an + // empty required variable). + it("gives FE-GATE-028 the release tag of a tag run and nothing otherwise (1112/05-01)", async () => { + const contract = await loadCiGateContract(process.cwd()); + const tag = "${{ startsWith(gitea.ref, 'refs/tags/v') && gitea.ref_name || '' }}"; + expect(contract.gates.find(({ id }) => id === "FE-GATE-028")?.requiresEnvironment).toEqual(["RELEASE_TAG"]); + expect(contract.jobs.find(({ id }) => id === "release_gate")?.environment).toEqual([ + { name: "RELEASE_TAG", value: tag }, + ]); + const workflow = renderCiWorkflow(contract); + const release = workflow.slice(workflow.indexOf("\n release_gate:\n"), workflow.indexOf("\n immutable_build:\n")); + expect(release).toContain(` env:\n RELEASE_TAG: ${JSON.stringify(tag)}\n`); + expect(workflow.match(/RELEASE_TAG:/gu)).toHaveLength(1); + + const unbound = JSON.parse(JSON.stringify(contract)) as Record; + unbound.jobs.find((job: Record) => job.id === "release_gate").environment = []; + expect(() => parseCiGateContract(unbound)).toThrow(/job release_gate lacks environment RELEASE_TAG for FE-GATE-028/u); + }); + it("keeps every platform route's signed review record as FE-GATE-028 evidence (1112/05-18)", async () => { // The evidence list is written by hand. EXAMPLES_PLATFORM's record was // missing from it while the review covers every registered route. A