feat(cicd): add bounded pipeline evidence
This commit is contained in:
@@ -398,6 +398,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),
|
||||
@@ -426,6 +427,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),
|
||||
@@ -436,6 +439,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)) : [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user