Skip to content

Commit 9e1758d

Browse files
pratap0007vikram-raj
authored andcommitted
Fix pipelinerun cancelation status
If pipelinerun spec has status reason CancelledRunFinally and pipelinerun has few finally tasks, if any finally task gets failed then pipelinerun status showing as Cancelling on the console UI. This patch handles Cancelling status of pipelinerun Signed-off-by: Shiv Verma <shverma@redhat.com>
1 parent e4b0b29 commit 9e1758d

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

‎src/components/utils/pipeline-filter-reducer.ts‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,25 @@ export enum SucceedConditionReason {
2020
export const pipelineRunStatus = (pipelineRun): ComputedStatus => {
2121
const conditions = _.get(pipelineRun, ['status', 'conditions'], []);
2222
if (conditions.length === 0) return null;
23-
23+
const cancelledReasons = [
24+
'Cancelled',
25+
'CancelledRunningFinally',
26+
'StoppedRunningFinally',
27+
];
2428
const succeedCondition = conditions.find((c) => c.type === 'Succeeded');
25-
const cancelledCondition = conditions.find((c) => c.reason === 'Cancelled');
29+
const cancelledCondition = conditions.find((c) =>
30+
cancelledReasons.includes(c.reason),
31+
);
32+
const cancelledStatus = conditions.find((c) => c.status === 'Unknown');
2633

2734
if (
2835
[
2936
SucceedConditionReason.PipelineRunStopped,
3037
SucceedConditionReason.PipelineRunCancelled,
38+
SucceedConditionReason.Cancelled,
3139
].includes(pipelineRun.spec?.status) &&
32-
!cancelledCondition
40+
cancelledCondition &&
41+
cancelledStatus
3342
) {
3443
return ComputedStatus.Cancelling;
3544
}

0 commit comments

Comments
 (0)