I am creating a Stackstorm workflow where I want to get the stdout result from one task and compare it in
an other task.
But I can’t manage to retreive the result value of my action.
Sample code:
actions/workflow/do_stuff.yaml
version: 1.0
description: do_stuff.
input:
- stuff
tasks:
do_stuff:
action: "core.local"
input:
cmd: "/usr/bin/do_stuff '{{ ctx('stuff') }}'"
timeout: 600
next:
- publish:
- stdout: "{{ result()['stdout'] }}"
- stderr: "{{ result()['stderr'] }}"
- when: <% failed() %>
do: fail
output:
- stdout: "{{ ctx('stdout') }}"
- stderr: "{{ ctx('stderr') }}"
actions/do_stuff.yaml
---
name: do_stuff
pack: stuff_pack
description: do some stuff
runner_type: orquesta
entry_point: workflows/do_stuff.yaml
enabled: true
parameters:
stuff:
required: true
type: "string"
description: "the stuff"
actions/workflow/lifecycle.yaml
version: 1.0
description: The stuff workflow
vars:
- stuff_result_stdout: null
tasks:
first_task:
action: "stuff_pack.do_stuff"
input:
stuff: "parameter"
next:
- publish:
- stuff_result_stdout: <% result().stdout %>
- when: "{{ succeeded() }}"
do:
- "second_task"
second_task:
action: core.echo message="msg-{{ ctx().stuff_result_stdout }}-"
On the Stackstorm web UI, i clearly see the output of my command (/usr/bin/do_stuff
)
with this line stuff_result_stdout: <% result().stdout %>
I have the error YaqlEvaluationException: Unable to resolve key 'stdout' in expression '<%result().stdout
%>' from context.
and when I try to get only result()
, and print it, I have None
.
How do I retreive the output of my action in first_task
?