Skip to content

Commit

Permalink
fix: check for nil, and add logging to expose root cause of panic in …
Browse files Browse the repository at this point in the history
…Issue 8968 (#9010)

* fix: add logging to expose root cause of panic

Signed-off-by: Julie Vogelman <[email protected]>

* fix: empty commit

Signed-off-by: Julie Vogelman <[email protected]>

* fix: empty commit

Signed-off-by: Julie Vogelman <[email protected]>
  • Loading branch information
juliev0 authored and sarabala1979 committed Jun 23, 2022
1 parent b7c218c commit 621b0d1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1944,10 +1944,24 @@ func (woc *wfOperationCtx) executeTemplate(ctx context.Context, nodeName string,
}

node = woc.wf.GetNodeByName(node.Name)
if node == nil {
err := fmt.Errorf("no Node found by the name of %s; wf.Status.Nodes=%+v", node.Name, woc.wf.Status.Nodes)
woc.log.Error(err)
woc.markWorkflowError(ctx, err)
return node, err
}

// Swap the node back to retry node
if retryNodeName != "" {
retryNode := woc.wf.GetNodeByName(retryNodeName)

if retryNode == nil {
err := fmt.Errorf("no Retry Node found by the name of %s; wf.Status.Nodes=%+v", retryNodeName, woc.wf.Status.Nodes)
woc.log.Error(err)
woc.markWorkflowError(ctx, err)
return node, err
}

if !retryNode.Fulfilled() && node.Fulfilled() { // if the retry child has completed we need to update outself
retryNode, err = woc.executeTemplate(ctx, retryNodeName, orgTmpl, tmplCtx, args, opts)
if err != nil {
Expand Down

0 comments on commit 621b0d1

Please sign in to comment.