Skip to content

Commit

Permalink
fix: ignore retry node when check succeeded descendant nodes. Fixes: #…
Browse files Browse the repository at this point in the history
…13003 (#13004)

Signed-off-by: shuangkun <tsk2013uestc@163.com>
(cherry picked from commit 71f1d86)
  • Loading branch information
shuangkun authored and agilgur5 committed May 27, 2024
1 parent e0925c9 commit 210f1f9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions test/e2e/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ func (s *CLISuite) TestRetryWorkflowWithContinueOn() {
Then().
ExpectWorkflow(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) {
workflowName = metadata.Name
assert.Equal(t, 6, len(status.Nodes))
assert.Equal(t, 7, len(status.Nodes))
}).
RunCli([]string{"retry", workflowName}, func(t *testing.T, output string, err error) {
if assert.NoError(t, err, output) {
Expand All @@ -940,10 +940,10 @@ func (s *CLISuite) TestRetryWorkflowWithContinueOn() {
ExpectWorkflow(func(t *testing.T, metadata *metav1.ObjectMeta, status *wfv1.WorkflowStatus) {
workflowName = metadata.Name
assert.Equal(t, wfv1.WorkflowFailed, status.Phase)
assert.Equal(t, 6, len(status.Nodes))
assert.Equal(t, 7, len(status.Nodes))
}).
ExpectWorkflowNode(func(status wfv1.NodeStatus) bool {
return strings.Contains(status.Name, "retry-workflow-with-continueon.success")
return strings.Contains(status.Name, ".success")
}, func(t *testing.T, status *wfv1.NodeStatus, pod *corev1.Pod) {
assert.Equal(t, 2, len(status.Children))
})
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/testdata/retry-workflow-with-continueon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ spec:
entrypoint: dag
templates:
- name: dag
retryStrategy:
limit: 2
retryPolicy: OnError
dag:
failFast: false
tasks:
Expand Down
2 changes: 1 addition & 1 deletion workflow/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ func FormulateRetryWorkflow(ctx context.Context, wf *wfv1.Workflow, restartSucce
log.Debugf("Reset %s node %s since it's a group node", node.Name, string(node.Phase))
continue
} else {
if isDescendantNodeSucceeded(wf, node, nodeIDsToReset) {
if node.Type != wfv1.NodeTypeRetry && isDescendantNodeSucceeded(wf, node, nodeIDsToReset) {
log.Debugf("Node %s remains as is since it has succeed child nodes.", node.Name)
newWF.Status.Nodes.Set(node.ID, node)
continue
Expand Down

0 comments on commit 210f1f9

Please sign in to comment.