From cd6f3627992b6947dd47c98420d0a0fec4de9112 Mon Sep 17 00:00:00 2001 From: Daisuke Taniwaki Date: Mon, 7 Oct 2019 14:16:47 +0900 Subject: [PATCH] Fix dag output aggregation correctly (#1649) --- workflow/controller/dag.go | 6 +++++- workflow/controller/operator.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/workflow/controller/dag.go b/workflow/controller/dag.go index d99583004b4f..5442d4868d33 100644 --- a/workflow/controller/dag.go +++ b/workflow/controller/dag.go @@ -446,7 +446,11 @@ func (woc *wfOperationCtx) resolveDependencyReferences(dagCtx *dagContext, task ancestorNodes = append(ancestorNodes, node) } } - err := woc.processAggregateNodeOutputs(nil, &scope, prefix, ancestorNodes) + tmpl := dagCtx.wf.GetStoredOrLocalTemplate(ancestorNode) + if tmpl == nil { + return nil, errors.InternalErrorf("Template of ancestor node '%s' not found", ancestorNode.Name) + } + err := woc.processAggregateNodeOutputs(tmpl, &scope, prefix, ancestorNodes) if err != nil { return nil, errors.InternalWrapError(err) } diff --git a/workflow/controller/operator.go b/workflow/controller/operator.go index 0180afc1df26..905a1fbb1cfe 100644 --- a/workflow/controller/operator.go +++ b/workflow/controller/operator.go @@ -1675,7 +1675,7 @@ func (woc *wfOperationCtx) processAggregateNodeOutputs(tmpl *wfv1.Template, scop } } } - if tmpl != nil && tmpl.GetType() == wfv1.TemplateTypeScript { + if tmpl.GetType() == wfv1.TemplateTypeScript { resultsJSON, err := json.Marshal(resultsList) if err != nil { return err