Skip to content

Commit 21ff00d

Browse files
committed
fix: memoize outputs null in steps and dag templates
When a steps or DAG template with memoize and outputs completes, the node is only re-fetched inside the 'if outputs != nil' block. The subsequent c.Save() call uses the same local node variable, so if outputs is nil, node.Outputs is stale/nil and 'outputs:null' gets written to the ConfigMap cache. Fix: always re-fetch the node unconditionally before the outputs assignment and cache save, so c.Save() always uses the latest node.Outputs from the store. Fixes: steps.go and dag.go Signed-off-by: om7057 <kulkarniom7057@gmail.com>
1 parent cac474d commit 21ff00d

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

workflow/controller/dag.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,12 @@ func (woc *wfOperationCtx) executeDAG(ctx context.Context, nodeName string, tmpl
366366
woc.log.Error(ctx, "unable to get outputs")
367367
return node, err
368368
}
369+
node, err = woc.wf.GetNodeByName(nodeName)
370+
if err != nil {
371+
woc.log.WithField("nodeName", nodeName).Error(ctx, "unable to get node by name for nodeName")
372+
return nil, err
373+
}
369374
if outputs != nil {
370-
node, err = woc.wf.GetNodeByName(nodeName)
371-
if err != nil {
372-
woc.log.WithField("nodeName", nodeName).Error(ctx, "unable to get node by name for nodeName")
373-
return nil, err
374-
}
375375
node.Outputs = outputs
376376
woc.wf.Status.Nodes.Set(ctx, node.ID, *node)
377377
}

workflow/controller/steps.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,11 @@ func (woc *wfOperationCtx) executeSteps(ctx context.Context, nodeName string, tm
199199
return node, err
200200
}
201201

202+
node, err = woc.wf.GetNodeByName(nodeName)
203+
if err != nil {
204+
return nil, err
205+
}
202206
if outputs != nil {
203-
node, err = woc.wf.GetNodeByName(nodeName)
204-
if err != nil {
205-
return nil, err
206-
}
207207
node.Outputs = outputs
208208
woc.addOutputsToGlobalScope(ctx, node.Outputs)
209209
woc.wf.Status.Nodes.Set(ctx, node.ID, *node)

0 commit comments

Comments
 (0)