fix: stabilize sentinel BuildKit evidence

This commit is contained in:
Codex
2026-07-13 16:25:28 +02:00
parent 58df3731b4
commit ca312ae714
5 changed files with 147 additions and 14 deletions
+38 -10
View File
@@ -1951,7 +1951,7 @@ function compactStatusJson(result: Record<string, unknown>): Record<string, unkn
};
}
function compactStatusSummary(summary: Record<string, unknown>): Record<string, unknown> {
export function compactStatusSummary(summary: Record<string, unknown>): Record<string, unknown> {
const latest = record(summary.latestPipelineRun);
const artifact = record(summary.artifact);
const argo = record(summary.argo);
@@ -1992,6 +1992,9 @@ function compactStatusSummary(summary: Record<string, unknown>): Record<string,
digest: artifact.digest,
gitopsCommit: artifact.gitopsCommit,
provenanceRelation: artifact.provenanceRelation,
traceId: artifact.traceId ?? latest.traceId,
firstBreak: artifact.firstBreak ?? latest.firstBreak,
error: artifact.error ?? latest.error,
},
argo: {
sync: argo.sync,
@@ -2051,7 +2054,7 @@ function compactCloseoutJson(result: Record<string, unknown>): Record<string, un
};
}
function compactHistoryJson(result: Record<string, unknown>, includeTaskDetails = false): Record<string, unknown> {
export function compactHistoryJson(result: Record<string, unknown>, includeTaskDetails = false): Record<string, unknown> {
const detailRequested = stringValue(result.detailId) !== "-";
return {
ok: result.ok === true,
@@ -2088,6 +2091,9 @@ function compactHistoryJson(result: Record<string, unknown>, includeTaskDetails
classification: row.classification,
envReuse: row.envReuse,
sourceObservation: row.sourceObservation,
traceId: row.traceId,
firstBreak: row.firstBreak,
error: row.error,
artifact: detailRequested ? {
imageStatus: artifact.imageStatus,
envReuse: artifact.envReuse,
@@ -2113,6 +2119,7 @@ function compactHistoryJson(result: Record<string, unknown>, includeTaskDetails
} : undefined,
collector: detailRequested ? {
mode: collector.mode,
matchingTaskCount: collector.matchingTaskCount,
contractTaskCount: collector.contractTaskCount,
terminalRecordCount: collector.terminalRecordCount,
logErrorCount: collector.logErrorCount,
@@ -2237,7 +2244,7 @@ function renderBootstrap(result: Record<string, unknown>): RenderedCliResult {
return rendered(result, "platform-infra pipelines-as-code bootstrap", lines);
}
function renderStatus(result: Record<string, unknown>): RenderedCliResult {
export function renderStatus(result: Record<string, unknown>): RenderedCliResult {
const summary = record(result.summary);
const consumer = record(result.consumer);
const deliveryAuthority = record(result.deliveryAuthority);
@@ -2248,6 +2255,9 @@ function renderStatus(result: Record<string, unknown>): RenderedCliResult {
const artifact = record(summary.artifact);
const argo = record(summary.argo);
const diagnostics = record(summary.diagnostics);
const latestFirstBreak = record(artifact.firstBreak ?? latest.firstBreak);
const latestError = record(artifact.error ?? latest.error);
const latestTraceId = stringValue(artifact.traceId ?? latest.traceId);
const admissionProvenance = record(summary.admissionProvenance);
const consumerBootstrap = record(summary.consumerBootstrap);
const bootstrapRunner = record(consumerBootstrap.runner);
@@ -2318,10 +2328,14 @@ function renderStatus(result: Record<string, unknown>): RenderedCliResult {
` repo-url: ${compactLine(stringValue(argo.repoURL))}`,
"",
"CICD DIAGNOSIS",
...table(["OK", "CODE", "PHASE", "SOURCE", "REGISTRY", "GITOPS", "RUNTIME"], [[
...table(["OK", "CODE", "PHASE", "TRACE", "FIRST_BREAK", "ERROR", "EXIT", "SOURCE", "REGISTRY", "GITOPS", "RUNTIME"], [[
boolText(diagnostics.ok !== false),
stringValue(diagnostics.code),
stringValue(diagnostics.phase),
stringValue(latestFirstBreak.phase ?? latestError.phase ?? diagnostics.phase),
short(latestTraceId, 16),
stringValue(latestFirstBreak.code),
`${stringValue(latestError.type)}/${stringValue(latestError.code)}`,
stringValue(latestError.exitCode),
short(stringValue(diagnostics.sourceCommit)),
registryText(record(diagnostics.registry)),
short(stringValue(record(diagnostics.gitops).commit)),
@@ -2407,7 +2421,7 @@ function renderCloseout(result: Record<string, unknown>): RenderedCliResult {
return rendered(result, "platform-infra pipelines-as-code closeout", lines);
}
function renderHistory(result: Record<string, unknown>): RenderedCliResult {
export function renderHistory(result: Record<string, unknown>): RenderedCliResult {
const rows = arrayRecords(result.rows);
const config = record(result.config);
const historyErrors = arrayRecords(result.historyErrors);
@@ -2424,17 +2438,26 @@ function renderHistory(result: Record<string, unknown>): RenderedCliResult {
]),
"",
"TRIGGERS",
...(rows.length === 0 ? ["-"] : table([timeHeader, "CONSUMER", "CLASS", "OWNER", "STATUS", "DUR_S", "COMMIT", "ENV_REUSE", "ID"], rows.map((row) => [
...(rows.length === 0 ? ["-"] : table([timeHeader, "CONSUMER", "CLASS", "OWNER", "STATUS", "TRACE", "FIRST_BREAK", "PHASE", "ERROR", "EXIT", "DUR_S", "COMMIT", "ENV_REUSE", "ID"], rows.map((row) => {
const firstBreak = record(row.firstBreak);
const error = record(row.error);
return [
stringValue(row.displayTime) === "-" ? isoShort(stringValue(row.triggeredAt)) : stringValue(row.displayTime),
stringValue(row.consumer),
stringValue(row.deliveryClass),
stringValue(row.deliveryOwner ?? row.executionOwner),
statusText(row),
short(stringValue(row.traceId), 16),
stringValue(firstBreak.code),
stringValue(firstBreak.phase ?? error.phase),
`${stringValue(error.type)}/${stringValue(error.code)}`,
stringValue(error.exitCode),
stringValue(row.durationSeconds),
short(stringValue(row.commit)),
envReuseText(record(row.envReuse)),
stringValue(row.id ?? row.pipelineRun),
]))),
];
}))),
...(detailId === "-" || rows.length !== 1 ? [] : renderHistoryDetail(rows[0] ?? {})),
"",
"NEXT",
@@ -2444,7 +2467,7 @@ function renderHistory(result: Record<string, unknown>): RenderedCliResult {
return rendered(result, "platform-infra pipelines-as-code history", lines.filter((line): line is string => line !== null));
}
function renderDebugStep(result: Record<string, unknown>): RenderedCliResult {
export function renderDebugStep(result: Record<string, unknown>): RenderedCliResult {
const checks = arrayRecords(result.checks);
const realRun = record(result.realRun);
const pipelineRun = record(realRun.pipelineRun);
@@ -2452,6 +2475,7 @@ function renderDebugStep(result: Record<string, unknown>): RenderedCliResult {
const catalog = record(artifact.catalog);
const terminal = arrayRecords(realRun.terminal);
const firstBreak = record(realRun.firstBreak);
const typedError = record(realRun.error);
const fixturePassed = checks.filter((item) => item.ok === true).length;
const lines = [
"PLATFORM-INFRA PIPELINES-AS-CODE DEBUG STEP",
@@ -2466,11 +2490,15 @@ function renderDebugStep(result: Record<string, unknown>): RenderedCliResult {
...(Object.keys(realRun).length === 0 ? [] : [
"",
"REAL PIPELINERUN EVIDENCE",
...table(["FOUND", "CLASS", "AUTHORITY", "STATUS", "SOURCE", "MODE", "VALID", "FIRST_BREAK"], [[
...table(["FOUND", "CLASS", "AUTHORITY", "STATUS", "TRACE", "PHASE", "ERROR", "EXIT", "SOURCE", "MODE", "VALID", "FIRST_BREAK"], [[
boolText(realRun.found),
stringValue(pipelineRun.deliveryClass),
boolText(pipelineRun.deliveryAuthorityEligible),
stringValue(pipelineRun.status ?? pipelineRun.reason),
short(stringValue(realRun.traceId), 16),
stringValue(firstBreak.phase ?? firstBreak.stage),
`${stringValue(typedError.type)}/${stringValue(typedError.code)}`,
stringValue(typedError.exitCode),
short(stringValue(pipelineRun.sourceCommit), 16),
stringValue(realRun.mode),
boolText(realRun.valid),