From b4c1ca36b0f6922cee01831f62e221e400492d8a Mon Sep 17 00:00:00 2001 From: FogDong Date: Fri, 27 May 2022 21:28:49 +0800 Subject: [PATCH] make finish condition more clear Signed-off-by: FogDong --- pkg/workflow/tasks/custom/task.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/workflow/tasks/custom/task.go b/pkg/workflow/tasks/custom/task.go index 378e66cc8..5dceabf4a 100644 --- a/pkg/workflow/tasks/custom/task.go +++ b/pkg/workflow/tasks/custom/task.go @@ -509,8 +509,14 @@ func IsStepFinish(phase common.WorkflowStepPhase, reason string) bool { if feature.DefaultMutableFeatureGate.Enabled(features.EnableSuspendOnFailure) { return phase == common.WorkflowStepPhaseSucceeded } - if phase == common.WorkflowStepPhaseFailed { + switch phase { + case common.WorkflowStepPhaseFailed: return reason == StatusReasonTerminate || reason == StatusReasonFailedAfterRetries + case common.WorkflowStepPhaseSkipped: + return true + case common.WorkflowStepPhaseSucceeded: + return true + default: + return false } - return phase == common.WorkflowStepPhaseSucceeded || phase == common.WorkflowStepPhaseSkipped }