feat(cicd): add bounded pipeline evidence
This commit is contained in:
@@ -55,7 +55,10 @@ if (key === "pipelineRun") {
|
||||
apiVersion: input.apiVersion,
|
||||
kind: input.kind,
|
||||
metadata: metadata(input),
|
||||
spec: { params: Array.isArray(input?.spec?.params) ? input.spec.params : [] },
|
||||
spec: {
|
||||
pipelineRef: { name: input?.spec?.pipelineRef?.name || null },
|
||||
params: Array.isArray(input?.spec?.params) ? input.spec.params : [],
|
||||
},
|
||||
status: {
|
||||
conditions: Array.isArray(input?.status?.conditions) ? input.status.conditions : [],
|
||||
startTime: input?.status?.startTime || null,
|
||||
@@ -65,6 +68,48 @@ if (key === "pipelineRun") {
|
||||
reason: succeeded?.reason || null,
|
||||
},
|
||||
};
|
||||
} else if (key === "pipeline") {
|
||||
const tasks = Array.isArray(input?.spec?.tasks) ? input.spec.tasks : [];
|
||||
const runtimeReady = tasks.find((item) => item?.name === "runtime-ready") || null;
|
||||
const gitopsPromote = tasks.find((item) => item?.name === "gitops-promote") || null;
|
||||
const gitopsResults = Array.isArray(gitopsPromote?.taskSpec?.results) ? gitopsPromote.taskSpec.results : [];
|
||||
output = {
|
||||
apiVersion: input.apiVersion,
|
||||
kind: input.kind,
|
||||
metadata: {
|
||||
name: input?.metadata?.name || null,
|
||||
namespace: input?.metadata?.namespace || null,
|
||||
annotations: {
|
||||
sourceConfig: input?.metadata?.annotations?.["hwlab.pikastech.local/source-config"] || null,
|
||||
ciContract: input?.metadata?.annotations?.["hwlab.pikastech.local/ci-contract"] || null,
|
||||
policy: input?.metadata?.annotations?.["hwlab.pikastech.local/policy"] || null,
|
||||
},
|
||||
},
|
||||
spec: {
|
||||
taskCount: tasks.length,
|
||||
runtimeReadyTask: {
|
||||
present: runtimeReady !== null,
|
||||
name: runtimeReady?.name || null,
|
||||
runAfter: Array.isArray(runtimeReady?.runAfter) ? runtimeReady.runAfter.slice(0, 6) : [],
|
||||
when: Array.isArray(runtimeReady?.when)
|
||||
? runtimeReady.when.slice(0, 4).map((item) => ({
|
||||
input: item?.input || null,
|
||||
operator: item?.operator || null,
|
||||
values: Array.isArray(item?.values) ? item.values.slice(0, 6) : [],
|
||||
}))
|
||||
: [],
|
||||
},
|
||||
gitopsPromoteTask: {
|
||||
present: gitopsPromote !== null,
|
||||
name: gitopsPromote?.name || null,
|
||||
resultNames: gitopsResults
|
||||
.map((item) => item?.name || null)
|
||||
.filter((item) => typeof item === "string")
|
||||
.slice(0, 8),
|
||||
runtimeReadyRequiredResult: gitopsResults.some((item) => item?.name === "runtime-ready-required"),
|
||||
},
|
||||
},
|
||||
};
|
||||
} else if (key === "taskRuns") {
|
||||
const items = (Array.isArray(input?.items) ? input.items : []).map((item) => {
|
||||
const succeeded = condition(item, "Succeeded");
|
||||
|
||||
Reference in New Issue
Block a user