Hi there, I am new to stackstorm. I need help to resolve the problem, I am having.
I am working on one workflow that will get variable information from first task and use that variable in second task using bash script. I see that is possible using python, but I would prefer to do with bash. Here is the workflow.
input:
- value1
- value2
- value3
output:
- value2: <% ctx().value2 %>
- value3: <% ctx().value3 %>
tasks:
task1:
action: jobname.get_info value1=<% ctx(value1) %>
next:
- when: <% succeeded() %>
publish:
- stdout: <% result().stdout %>
- stderr: <% result().stderr %>
- value2: <% ctx("value2") %>, <% result().result %>
- value3: <% ctx("value3") %>, <% result().result %>
- do: task2
- when: <% failed() %>
publish: stderr=<% result().stderr %>
do: fail
task2:
action: job.name2 value2=<% ctx(value2) %>
next:
- when: <% succeeded() %>
publish:
- stdout: <% result().stdout %>
- stderr: <% result().stderr %>
- do: task3
- when: <% failed() %>
publish: stderr=<% result().stderr %>
do: fail
I see that the first job gets succeeded without any error, but the second job uses value2
in
the execution, so it won’t move forward in execution and errors out.
{
"output": null,
"errors": [
{
"message": "YaqlEvaluationException: Unable to resolve key 'result' in expression '<% result().result %>' from context.",
"task_transition_id": "noop__t0",
"type": "error",
"route": 0,
"task_id": "task1"
},
{
"message": "YaqlEvaluationException: Unable to evaluate expression '<% ctx(stdout) %>'. VariableUndefinedError: The variable \"stdout\" is undefined.",
"type": "error"
}
]
}
Thanks in advance!!