Merge pull request #1508 from pikasTech/fix/1499-hwlab-pipeline-evidence

feat: add bounded branch-follower pipeline evidence
This commit is contained in:
Lyon
2026-07-04 10:56:04 +08:00
committed by GitHub
13 changed files with 287 additions and 3 deletions
+29
View File
@@ -400,6 +400,7 @@ function compactStatusGates(payload: Record<string, unknown> | null): Record<str
},
tekton: tekton === null ? null : {
name: stringOrNull(tekton.name),
pipelineRefName: stringOrNull(tekton.pipelineRefName),
succeeded: tekton.succeeded === true ? true : tekton.succeeded === false ? false : null,
reason: stringOrNull(tekton.reason),
startTime: stringOrNull(tekton.startTime),
@@ -428,6 +429,8 @@ function compactStatusGates(payload: Record<string, unknown> | null): Record<str
nonReadyResources: Array.isArray(argo.nonReadyResources) ? argo.nonReadyResources.slice(0, 5) : [],
ready: argo.ready === true,
},
pipeline: compactPipeline(payload.pipeline),
refreshEvidence: compactRefreshEvidence(payload.refreshEvidence),
runtime: runtime === null ? null : {
ready: runtime.ready === true,
targetSha: stringOrNull(runtime.targetSha),
@@ -438,6 +441,32 @@ function compactStatusGates(payload: Record<string, unknown> | null): Record<str
};
}
function compactPipeline(value: unknown): Record<string, unknown> | null {
const pipeline = asOptionalRecord(value);
if (pipeline === null) return null;
return {
metadata: asOptionalRecord(pipeline.metadata),
spec: asOptionalRecord(pipeline.spec),
};
}
function compactRefreshEvidence(value: unknown): Record<string, unknown> | null {
const refresh = asOptionalRecord(value);
if (refresh === null) return null;
return {
jobName: stringOrNull(refresh.jobName),
namespace: stringOrNull(refresh.namespace),
status: stringOrNull(refresh.status),
pipeline: stringOrNull(refresh.pipeline),
sourceCommit: stringOrNull(refresh.sourceCommit),
sourceStageRef: stringOrNull(refresh.sourceStageRef),
elapsedMs: numberOrNull(refresh.elapsedMs),
sourceAuthority: stringOrNull(refresh.sourceAuthority),
statusAuthority: stringOrNull(refresh.statusAuthority),
parsedDownstreamCliOutput: false,
};
}
function arrayRecords(value: unknown): Record<string, unknown>[] {
return Array.isArray(value) ? value.filter((item): item is Record<string, unknown> => typeof item === "object" && item !== null && !Array.isArray(item)) : [];
}