Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: check condition on result of child step #546

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ A user can be allowed to resolve a task in four ways:
- `.pre_hook.metadata.HTTPStatus`: field `HTTPStatus` from the metadata of the step's pre-hook (see [pre-hooks](#pre-hooks))
- `.function_args.[ARG_NAME]`: argument that needs to be given in the conifguration section to the function (see `functions` below)

`STEP_NAME` can bear the special value `this`, which refers to the current step.

The following templating functions are available:

| Name | Description | Reference |
Expand Down Expand Up @@ -736,7 +738,7 @@ conditions:
- type: skip
foreach: parent
if:
- value: '{{ step.previousCheck.output.result }}'
- value: '{{ .step.previousCheck.output.result }}'
operator: EQ
expected: 'already_done'
then:
Expand All @@ -745,6 +747,27 @@ conditions:

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

It's also possible to write a `check` condition on the result of a child step with `.step.this`:

```yaml
foreach: '{{.step.aPreviousStep.output.ids | toJson}}'
custom_states: [NOT_FOUND]
action:
type: echo
configuration:
output:
url: '{{ .iterator }}'
conditions:
- type: check
foreach: children # <- can be omitted
if:
- value: '{{ .step.this.metadata.HTTPStatus }}'
operator: EQ
expected: '404'
then:
this: NOT_FOUND
```

#### Resources <a name="resources"></a>

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