chore(review): 1106 release 게이트 조치 브랜치를 합친다
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"owner": "DongHyeonka",
|
||||
"reason": "1105/12-01: FE-GATE-013 hostRequirements are part of the reviewed gate shape",
|
||||
"reason": "1106/13-01: FE-GATE-027 runs the advisory scan before the release admission",
|
||||
"gates": 27,
|
||||
"commands": 100,
|
||||
"commandReferences": 104,
|
||||
"artifacts": 110,
|
||||
"stages": 5,
|
||||
"gateShapeSha256": "7bebafe65d528be6a59d4bb70edd2cad99455b2b49087e4a46b83d77bfd163de"
|
||||
"gateShapeSha256": "7f6f3d975c62c022d6a6f8b5f39562f73de9ca0f22aa3d086ac28959e50fa93e"
|
||||
}
|
||||
|
||||
@@ -2209,8 +2209,8 @@
|
||||
"id": "FE-GATE-027",
|
||||
"name": "release-admission",
|
||||
"commandIds": [
|
||||
"check-release-admission",
|
||||
"scan-dependency-advisories"
|
||||
"scan-dependency-advisories",
|
||||
"check-release-admission"
|
||||
],
|
||||
"logArtifactId": "artifact-artifacts-quality-gates-FE-GATE-027-txt",
|
||||
"evidenceArtifactIds": [
|
||||
|
||||
@@ -168,7 +168,11 @@ Producer는 게시 전에 manifest가 선언한 exact member set과 각 byte dig
|
||||
검증하고 archive SHA-256을 job output으로 고정한다. 같은 job은 마지막 단계에서
|
||||
FE-GATE-015·027의 gate log와 evidence, `scan:dependency-advisories` 기록을 후보와
|
||||
다른 이름(`immutable-gate-evidence-<run>-<attempt>`)으로 성공·실패와 상관없이
|
||||
올린다(1105/13-01). `ci:gate`는 명령 출력을 gate log에만 쓰고 콘솔에는 한 줄만
|
||||
올린다(1105/13-01). 올라가는 것은 그 run에 생긴 파일이다. `ci:gate`는 처음 실패한
|
||||
명령에서 멈추므로 FE-GATE-027은 막지 않는 advisory 검사를 승인보다 먼저 돌린다.
|
||||
그래서 승인이 거절된 run에도 advisory 기록이 있다(1106/13-01). FE-GATE-015가
|
||||
실패하면 FE-GATE-027이 돌지 않으므로 그 run에는 FE-GATE-027의 log와 advisory
|
||||
기록이 없다. `ci:gate`는 명령 출력을 gate log에만 쓰고 콘솔에는 한 줄만
|
||||
남기므로, release 단계의 실패 이유는 이 산출물에서 읽는다. 후보 archive의 member
|
||||
set은 그대로다. Vulnerability/provenance
|
||||
provider job은 같은 archive를 각각 내려받아 output SHA-256과 exact member set을
|
||||
@@ -528,7 +532,8 @@ Repository variables required by higher tiers:
|
||||
job runs FE-GATE-015 and then FE-GATE-027, and FE-GATE-027 refuses the
|
||||
candidate when `APP_PROFILE` is set and differs from `RELEASE_TARGET`. Both are
|
||||
repository-wide variables, so set them together for each release.
|
||||
FE-GATE-027 then runs `scan:dependency-advisories` (1103/13-03). It applies
|
||||
FE-GATE-027 runs `scan:dependency-advisories` first and the admission after
|
||||
it (1103/13-03, 1106/13-01). It applies
|
||||
`config/security/vulnerability-policy.json` and its exceptions to the
|
||||
registry's advisory report for the lockfile (pnpm's audit command with
|
||||
`--json`) and writes the result to the gate log
|
||||
@@ -540,7 +545,11 @@ Repository variables required by higher tiers:
|
||||
The job console shows only one PASS/FAIL line per gate, so the
|
||||
immutable_build job uploads both gates' logs and evidence and this record as
|
||||
the run artifact `immutable-gate-evidence-<run>-<attempt>`, whether the job
|
||||
passed or failed (1105/13-01). Read why FE-GATE-015 or FE-GATE-027 failed,
|
||||
passed or failed (1105/13-01). It holds the files the run produced. `ci:gate`
|
||||
stops at the first command that fails, and the scan runs before the
|
||||
admission, so a run whose admission was refused still has the advisory
|
||||
record. When FE-GATE-015 fails, FE-GATE-027 does not run, and the run has
|
||||
neither its log nor the record. Read why FE-GATE-015 or FE-GATE-027 failed,
|
||||
and the advisory status, there.
|
||||
`renovate.json` opens security update PRs once a Renovate runner is attached;
|
||||
a dependency update re-approves the dependency baseline in the same change
|
||||
|
||||
@@ -9,7 +9,8 @@ import {
|
||||
|
||||
/**
|
||||
* 1103/13-03. Release-stage signal for known dependency advisories
|
||||
* (FE-GATE-027, next to the release admission of the candidate). It runs
|
||||
* (FE-GATE-027, before the release admission of the candidate, so a refused
|
||||
* candidate still leaves the record: 1106/13-01). It runs
|
||||
* `pnpm audit --json` over the lockfile and applies
|
||||
* config/security/vulnerability-policy.json with its exceptions, the policy the
|
||||
* production promotion provider is held to. The result is a line in the gate
|
||||
|
||||
@@ -6,6 +6,7 @@ import path from "node:path";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
|
||||
import { loadCiGateContract } from "../../../scripts/contracts/ci-gates.ts";
|
||||
import { DEPENDENCY_ADVISORIES_RECORD_PATH } from "../../../scripts/lib/dependency-advisories.ts";
|
||||
import { FIXTURE_PNPM_ENVIRONMENT } from "../../../scripts/lib/fixture-node-modules.ts";
|
||||
|
||||
// F-12. The temp roots have a package.json but no node_modules or lockfile.
|
||||
@@ -184,3 +185,65 @@ describe("CI-runner gate output budget", () => {
|
||||
);
|
||||
}, 20_000);
|
||||
});
|
||||
|
||||
// 1106/13-01. ci:gate stops at the first command that fails. FE-GATE-027 ran
|
||||
// the admission first, so a refused candidate left no advisory record, and the
|
||||
// release evidence the operations guide points to had none. The two package
|
||||
// scripts are stand-ins: the admission refuses, the scan writes its record.
|
||||
describe("CI-runner FE-GATE-027 advisory record", () => {
|
||||
it("writes the advisory record when the release admission refuses the candidate", async () => {
|
||||
const root = await mkdtemp(path.join(tmpdir(), "ci-gate-refused-admission-"));
|
||||
temporaryRoots.push(root);
|
||||
await mkdir(path.join(root, "config/ci"), { recursive: true });
|
||||
await mkdir(path.join(root, path.dirname(DEPENDENCY_ADVISORIES_RECORD_PATH)), {
|
||||
recursive: true,
|
||||
});
|
||||
const contract = JSON.parse(
|
||||
JSON.stringify(await loadCiGateContract(process.cwd())),
|
||||
) as Record<string, any>;
|
||||
const gate = contract.gates.find(
|
||||
(entry: Record<string, any>) => entry.id === "FE-GATE-027",
|
||||
);
|
||||
const logArtifact = contract.artifacts.find(
|
||||
(entry: Record<string, any>) => entry.id === gate.logArtifactId,
|
||||
);
|
||||
const packageDocument = JSON.parse(
|
||||
await readFile("package.json", "utf8"),
|
||||
) as { scripts: Record<string, string> };
|
||||
packageDocument.scripts["check:release-admission"] =
|
||||
`node -e "process.stderr.write('release admission refused for production: fixture'),process.exit(1)"`;
|
||||
packageDocument.scripts["scan:dependency-advisories"] =
|
||||
`node -e 'require("node:fs").writeFileSync(${JSON.stringify(DEPENDENCY_ADVISORIES_RECORD_PATH)}, "fixture record")'`;
|
||||
await writeFile(
|
||||
path.join(root, "config/ci/gates.json"),
|
||||
`${JSON.stringify(contract)}\n`,
|
||||
);
|
||||
await writeFile(
|
||||
path.join(root, "config/ci/contract-baseline.json"),
|
||||
await readFile("config/ci/contract-baseline.json"),
|
||||
);
|
||||
await writeFile(
|
||||
path.join(root, "package.json"),
|
||||
`${JSON.stringify(packageDocument)}\n`,
|
||||
);
|
||||
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
[path.resolve("scripts/run-ci-gate.ts"), "FE-GATE-027"],
|
||||
{
|
||||
cwd: root,
|
||||
encoding: "utf8",
|
||||
env: { ...process.env, ...FIXTURE_PNPM_ENVIRONMENT, CI: "false" },
|
||||
timeout: 15_000,
|
||||
},
|
||||
);
|
||||
|
||||
expect(result.status, result.stderr).toBe(1);
|
||||
expect(
|
||||
await readFile(path.join(root, logArtifact.path), "utf8"),
|
||||
).toContain("release admission refused for production: fixture");
|
||||
expect(
|
||||
await readFile(path.join(root, DEPENDENCY_ADVISORIES_RECORD_PATH), "utf8"),
|
||||
).toBe("fixture record");
|
||||
}, 20_000);
|
||||
});
|
||||
|
||||
@@ -96,7 +96,11 @@ describe("dependency advisory summary (1103/13-03)", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("runs at release admission (FE-GATE-027) and never fails the gate by itself", async () => {
|
||||
// 1106/13-01. ci:gate stops at the first command that fails. With the scan
|
||||
// after the admission, a refused run had no advisory record, while the
|
||||
// operations guide says the release evidence carries it. The scan never
|
||||
// fails, so running it first leaves the admission verdict as it was.
|
||||
it("runs before the release admission (FE-GATE-027) and never fails the gate by itself", async () => {
|
||||
const contract = JSON.parse(await readFile("config/ci/gates.json", "utf8")) as {
|
||||
gates: { id: string; commandIds: string[] }[];
|
||||
commands: { id: string; script: string }[];
|
||||
@@ -104,7 +108,7 @@ describe("dependency advisory summary (1103/13-03)", () => {
|
||||
const scripts = (contract.gates.find(({ id }) => id === "FE-GATE-027")?.commandIds ?? []).map(
|
||||
(commandId) => contract.commands.find(({ id }) => id === commandId)?.script,
|
||||
);
|
||||
expect(scripts).toEqual(["check:release-admission", "scan:dependency-advisories"]);
|
||||
expect(scripts).toEqual(["scan:dependency-advisories", "check:release-admission"]);
|
||||
const source = await readFile("scripts/scan-dependency-advisories.ts", "utf8");
|
||||
expect(source).not.toMatch(/process\.exit(?:Code)?\s*(?:=|\()\s*[1-9]/u);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user