fix: add branch follower closeout gates
This commit is contained in:
@@ -137,6 +137,21 @@ if (key === "pipelineRun") {
|
||||
};
|
||||
} else if (key === "argoApplication") {
|
||||
const resources = Array.isArray(input?.status?.resources) ? input.status.resources : [];
|
||||
const syncResultResources = Array.isArray(input?.status?.operationState?.syncResult?.resources)
|
||||
? input.status.operationState.syncResult.resources
|
||||
.filter(problemSyncResource)
|
||||
.slice(0, 8)
|
||||
.map((item) => ({
|
||||
group: item.group || null,
|
||||
kind: item.kind || null,
|
||||
namespace: item.namespace || null,
|
||||
name: item.name || null,
|
||||
status: item.status || null,
|
||||
hookPhase: item.hookPhase || null,
|
||||
syncPhase: item.syncPhase || null,
|
||||
message: item.message || null,
|
||||
}))
|
||||
: [];
|
||||
const nonReadyResources = resources
|
||||
.filter((item) => item?.health?.status && item.health.status !== "Healthy")
|
||||
.slice(0, 8)
|
||||
@@ -166,6 +181,7 @@ if (key === "pipelineRun") {
|
||||
startedAt: input.status.operationState.startedAt || null,
|
||||
finishedAt: input.status.operationState.finishedAt || null,
|
||||
durationSeconds: durationSeconds(input.status.operationState.startedAt, input.status.operationState.finishedAt),
|
||||
syncResultResources,
|
||||
}
|
||||
: null,
|
||||
},
|
||||
@@ -194,3 +210,10 @@ if (key === "pipelineRun") {
|
||||
}
|
||||
|
||||
console.log(JSON.stringify(output));
|
||||
|
||||
function problemSyncResource(item) {
|
||||
const message = String(item?.message || "");
|
||||
return (item?.status && item.status !== "Synced")
|
||||
|| (item?.hookPhase && item.hookPhase !== "Succeeded")
|
||||
|| /fail|error|backoff|forbidden|invalid|denied|exceeded/iu.test(message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user