make finish condition more clear

Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>
This commit is contained in:
FogDong
2022-05-27 21:28:49 +08:00
parent 784e5f5db3
commit b4c1ca36b0
+8 -2
View File
@@ -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
}