diff --git a/workflow/controller/inline_test.go b/workflow/controller/inline_test.go new file mode 100644 index 000000000000..6147741ae855 --- /dev/null +++ b/workflow/controller/inline_test.go @@ -0,0 +1,41 @@ +package controller + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + + wfv1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1" +) + +func TestInlineDAG(t *testing.T) { + wf := wfv1.MustUnmarshalWorkflow(` +apiVersion: argoproj.io/v1alpha1 +kind: Workflow +metadata: + generateName: inline- +spec: + entrypoint: main + templates: + - name: main + dag: + tasks: + - name: a + inline: + container: + image: argoproj/argosay:v2 + args: + - echo + - "{{inputs.parameters.foo}}" + inputs: + parameters: + - name: foo + value: bar +`) + cancel, wfc := newController(wf) + defer cancel() + woc := newWorkflowOperationCtx(wf, wfc) + woc.operate(context.Background()) + assert.Equal(t, wfv1.WorkflowRunning, woc.wf.Status.Phase) +} diff --git a/workflow/validate/validate.go b/workflow/validate/validate.go index 9c49cebe70e4..a8b3470107ef 100644 --- a/workflow/validate/validate.go +++ b/workflow/validate/validate.go @@ -1286,6 +1286,12 @@ func (ctx *templateValidationCtx) validateDAG(scope map[string]interface{}, tmpl aggregate := len(ancestorTask.WithItems) > 0 || ancestorTask.WithParam != "" ctx.addOutputsToScope(resolvedTmpl, ancestorPrefix, taskScope, aggregate, true) } + if i := task.Inline; i != nil { + for _, p := range i.Inputs.Parameters { + taskScope["inputs.parameters."+p.Name] = placeholderGenerator.NextPlaceholder() + } + } + err = addItemsToScope(task.WithItems, task.WithParam, task.WithSequence, taskScope) if err != nil { return errors.Errorf(errors.CodeBadRequest, "templates.%s.tasks.%s %s", tmpl.Name, task.Name, err.Error())