暴露项目发布 gate manifest API

This commit is contained in:
2026-06-16 10:31:50 +08:00
parent 6c087499fd
commit 343ad0acd6
12 changed files with 188 additions and 19 deletions

View File

@@ -98,6 +98,21 @@ function arrayOrEmpty(value) {
return Array.isArray(value) ? value : [];
}
export function createProjectReleaseGateManifest() {
return {
apiName: "project-release-gate-manifest",
manifestVersion: 1,
gateCount: REQUIRED_RELEASE_GATES.length,
gateIds: REQUIRED_RELEASE_GATES.map(({ id }) => id),
gates: REQUIRED_RELEASE_GATES.map((gate) => ({
id: gate.id,
label: gate.label,
command: gate.command,
expectedOutput: gate.expectedOutput ?? null,
})),
};
}
export function createProjectReleaseReadinessReport({
gateResults = {},
observedOutputs = [],
@@ -106,7 +121,8 @@ export function createProjectReleaseReadinessReport({
promotedRuntimeFamilies = [],
} = {}) {
const outputs = Array.isArray(observedOutputs) ? observedOutputs : [];
const gateRows = REQUIRED_RELEASE_GATES.map((gate) => {
const gateManifest = createProjectReleaseGateManifest();
const gateRows = gateManifest.gates.map((gate) => {
const passed = readGatePassed({ gate, gateResults, observedOutputs: outputs });
return {
id: gate.id,
@@ -149,6 +165,7 @@ export function createProjectReleaseReadinessReport({
blockedRuntimeFamilies: blockedFamilies,
promotedRuntimeFamilies: promotedFamilies,
promotedBlockedFamilies,
gateManifest,
gates: gateRows,
rows: [
{
@@ -215,6 +232,8 @@ export function createProjectReleaseReadinessArtifactValidation(artifact = {}) {
artifactApiName: artifactObject.apiName ?? null,
artifactVersion: artifactObject.reportVersion ?? null,
gateCount: gates.length,
expectedGateCount: REQUIRED_RELEASE_GATES.length,
expectedGateIds: createProjectReleaseGateManifest().gateIds,
blockedRuntimeFamilies: arrayOrEmpty(artifactObject.blockedRuntimeFamilies),
rows: [
{