Feat(workflow): input.ParameterKey described like paths notation (#2214)

* Feat(workflow): input.ParameterKey path notation

* Feat(workflow): add test case

* Fix(lint): format code
This commit is contained in:
Jian.Li
2021-09-01 11:34:16 +08:00
committed by GitHub
parent 2d1edbb16d
commit 1a6d2be6d0
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -109,7 +109,7 @@ func (t *TaskLoader) makeTaskGenerator(templ string) (wfTypes.TaskGenerator, err
if err != nil {
return common.WorkflowStepStatus{}, nil, errors.WithMessagef(err, "get input from [%s]", input.From)
}
if err := paramsValue.FillObject(inputValue, input.ParameterKey); err != nil {
if err := paramsValue.FillObject(inputValue, strings.Split(input.ParameterKey, ".")...); err != nil {
return common.WorkflowStepStatus{}, nil, err
}
}
+2 -2
View File
@@ -48,7 +48,7 @@ myIP: value: "1.1.1.1"
return v.FillObject(ip)
},
"input": func(ctx wfContext.Context, v *value.Value, act types.Action) error {
val, err := v.LookupValue("prefixIP")
val, err := v.LookupValue("set", "prefixIP")
assert.NilError(t, err)
str, err := val.CueValue().String()
assert.NilError(t, err)
@@ -87,7 +87,7 @@ myIP: value: "1.1.1.1"
Type: "input",
Inputs: v1beta1.StepInputs{{
From: "podIP",
ParameterKey: "prefixIP",
ParameterKey: "set.prefixIP",
}},
},
{