Skip to content

Commit d43c0ec

Browse files
committed
doc: check condition on result of child step
Signed-off-by: Gabriel Augendre <[email protected]>
1 parent 03aed02 commit d43c0ec

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

README.md

+24-1
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ A user can be allowed to resolve a task in four ways:
248248
- `.pre_hook.metadata.HTTPStatus`: field `HTTPStatus` from the metadata of the step's pre-hook (see [pre-hooks](#pre-hooks))
249249
- `.function_args.[ARG_NAME]`: argument that needs to be given in the conifguration section to the function (see `functions` below)
250250

251+
`STEP_NAME` can bear the special value `this`, which refers to the current step.
252+
251253
The following templating functions are available:
252254

253255
| Name | Description | Reference |
@@ -736,7 +738,7 @@ conditions:
736738
- type: skip
737739
foreach: parent
738740
if:
739-
- value: '{{ step.previousCheck.output.result }}'
741+
- value: '{{ .step.previousCheck.output.result }}'
740742
operator: EQ
741743
expected: 'already_done'
742744
then:
@@ -745,6 +747,27 @@ conditions:
745747

746748
will be run before creating any children, by pruning the parent.
747749

750+
It's also possible to write a `check` condition on the result of a child step with `.step.this`:
751+
752+
```yaml
753+
foreach: '{{.step.aPreviousStep.output.ids | toJson}}'
754+
custom_states: [NOT_FOUND]
755+
action:
756+
type: echo
757+
configuration:
758+
output:
759+
url: '{{ .iterator }}'
760+
conditions:
761+
- type: check
762+
foreach: children # <- can be omitted
763+
if:
764+
- value: '{{ .step.this.metadata.HTTPStatus }}'
765+
operator: EQ
766+
expected: '404'
767+
then:
768+
this: NOT_FOUND
769+
```
770+
748771
#### Resources <a name="resources"></a>
749772

750773
Resources are a way to restrict the concurrency factor of operations, to control the throughput and avoid dangerous behavior (e.g. flooding the targets).

0 commit comments

Comments
 (0)