cicd avoid noop timing fallback
This commit is contained in:
+6
-2
@@ -2150,14 +2150,17 @@ function totalTimingFromCommand(command: Record<string, unknown> | undefined, ph
|
||||
|
||||
function totalTimingFromStored(storedTimings: Record<string, unknown> | null | undefined, phase?: BranchFollowerPhase): { seconds: number; status: string; source: string; startedAt: string | null; finishedAt: string | null } | null {
|
||||
if (storedTimings === null || storedTimings === undefined) return null;
|
||||
const status = stringOrNull(storedTimings.totalStatus);
|
||||
const source = stringOrNull(storedTimings.totalSource);
|
||||
if (phase === "Noop" && status === "noop" && source === "tekton-pipelinerun-start") return null;
|
||||
const startedAt = stringOrNull(storedTimings.startedAt);
|
||||
const finishedAt = stringOrNull(storedTimings.finishedAt);
|
||||
const seconds = totalSecondsFromRange(startedAt, finishedAt) ?? numberOrNull(storedTimings.totalSeconds);
|
||||
if (seconds === null) return null;
|
||||
return {
|
||||
seconds,
|
||||
status: finishedAt === null && phase !== undefined && !terminalPhase(phase) ? phase.toLowerCase() : stringOrNull(storedTimings.totalStatus) ?? "recorded",
|
||||
source: stringOrNull(storedTimings.totalSource) ?? "stored-state",
|
||||
status: finishedAt === null && phase !== undefined && !terminalPhase(phase) ? phase.toLowerCase() : status ?? "recorded",
|
||||
source: source ?? "stored-state",
|
||||
startedAt,
|
||||
finishedAt,
|
||||
};
|
||||
@@ -2165,6 +2168,7 @@ function totalTimingFromStored(storedTimings: Record<string, unknown> | null | u
|
||||
|
||||
function totalTimingFromLivePayload(payload: Record<string, unknown> | null, phase?: BranchFollowerPhase): { seconds: number; status: string; source: string; startedAt: string | null; finishedAt: string | null } | null {
|
||||
if (payload === null) return null;
|
||||
if (phase === "Noop") return null;
|
||||
const tekton = asOptionalRecord(payload.tekton);
|
||||
const startedAt = stringOrNull(tekton?.startTime);
|
||||
if (startedAt === null) return null;
|
||||
|
||||
Reference in New Issue
Block a user