Skip to content

Commit

Permalink
fix(controller): Reinstate support for outputs.results for containers.
Browse files Browse the repository at this point in the history
…Fixes #6428 (#6434)

Signed-off-by: Alex Collins <[email protected]>
  • Loading branch information
alexec authored and sarabala1979 committed Jul 27, 2021
1 parent d2fc4dd commit 9337abb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions workflow/controller/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ func (woc *wfOperationCtx) buildLocalScopeFromTask(dagCtx *dagContext, task *wfv
ancestorNodes = append(ancestorNodes, node)
}
}
_, tmpl, templateStored, err := dagCtx.tmplCtx.ResolveTemplate(ancestorNode)
_, _, templateStored, err := dagCtx.tmplCtx.ResolveTemplate(ancestorNode)
if err != nil {
return nil, errors.InternalWrapError(err)
}
Expand All @@ -517,7 +517,7 @@ func (woc *wfOperationCtx) buildLocalScopeFromTask(dagCtx *dagContext, task *wfv
woc.updated = true
}

err = woc.processAggregateNodeOutputs(tmpl, scope, prefix, ancestorNodes)
err = woc.processAggregateNodeOutputs(scope, prefix, ancestorNodes)
if err != nil {
return nil, errors.InternalWrapError(err)
}
Expand Down Expand Up @@ -626,7 +626,7 @@ func expandTask(task wfv1.DAGTask) ([]wfv1.DAGTask, error) {
} else if task.WithParam != "" {
err = json.Unmarshal([]byte(task.WithParam), &items)
if err != nil {
return nil, errors.Errorf(errors.CodeBadRequest, "withParam value could not be parsed as a JSON list: %s", strings.TrimSpace(task.WithParam))
return nil, errors.Errorf(errors.CodeBadRequest, "withParam value could not be parsed as a JSON list: %s: %v", strings.TrimSpace(task.WithParam), err)
}
} else if task.WithSequence != nil {
items, err = expandSequence(task.WithSequence)
Expand Down
4 changes: 2 additions & 2 deletions workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2561,7 +2561,7 @@ func (n loopNodes) Swap(i, j int) {

// processAggregateNodeOutputs adds the aggregated outputs of a withItems/withParam template as a
// parameter in the form of a JSON list
func (woc *wfOperationCtx) processAggregateNodeOutputs(tmpl *wfv1.Template, scope *wfScope, prefix string, childNodes []wfv1.NodeStatus) error {
func (woc *wfOperationCtx) processAggregateNodeOutputs(scope *wfScope, prefix string, childNodes []wfv1.NodeStatus) error {
if len(childNodes) == 0 {
return nil
}
Expand Down Expand Up @@ -2594,7 +2594,7 @@ func (woc *wfOperationCtx) processAggregateNodeOutputs(tmpl *wfv1.Template, scop
resultsList = append(resultsList, item)
}
}
if tmpl.GetType() == wfv1.TemplateTypeScript {
{
resultsJSON, err := json.Marshal(resultsList)
if err != nil {
return err
Expand Down
6 changes: 3 additions & 3 deletions workflow/controller/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (woc *wfOperationCtx) executeSteps(ctx context.Context, nodeName string, tm
}
if len(childNodes) > 0 {
// Expanded child nodes should be created from the same template.
_, tmpl, templateStored, err := stepsCtx.tmplCtx.ResolveTemplate(&childNodes[0])
_, _, templateStored, err := stepsCtx.tmplCtx.ResolveTemplate(&childNodes[0])
if err != nil {
return node, err
}
Expand All @@ -128,7 +128,7 @@ func (woc *wfOperationCtx) executeSteps(ctx context.Context, nodeName string, tm
woc.updated = true
}

err = woc.processAggregateNodeOutputs(tmpl, stepsCtx.scope, prefix, childNodes)
err = woc.processAggregateNodeOutputs(stepsCtx.scope, prefix, childNodes)
if err != nil {
return node, err
}
Expand Down Expand Up @@ -439,7 +439,7 @@ func (woc *wfOperationCtx) expandStep(step wfv1.WorkflowStep) ([]wfv1.WorkflowSt
} else if step.WithParam != "" {
err = json.Unmarshal([]byte(step.WithParam), &items)
if err != nil {
return nil, errors.Errorf(errors.CodeBadRequest, "withParam value could not be parsed as a JSON list: %s", strings.TrimSpace(step.WithParam))
return nil, errors.Errorf(errors.CodeBadRequest, "withParam value could not be parsed as a JSON list: %s: %v", strings.TrimSpace(step.WithParam), err)
}
} else if step.WithSequence != nil {
items, err = expandSequence(step.WithSequence)
Expand Down

0 comments on commit 9337abb

Please sign in to comment.