Skip to content

while

The while keyword is used to run steps repeatedly similar to a “while” loop. A jinja expression will be evaluated at runtime and if “true” will repeat the step action. The loop exits when the while condition evaluates to “false”.

while: string
pause: float

pause

As with the loop keyword, pause injects a delay between iterations of running a step. As a protection, there is a default delay of 1s. This is to avoid overwhelming downstream systems such as API calls when using steps. The default can be overridden by setting the pause to some other number of seconds.

Examples

Repeat a step n times

The following YAML snippet shows how a while loop can be defined:

steps:
  - name: repeat_while
    params:
        output: "run{{ steps.repeat_while.runs }}"
    while: "{{ (steps.repeat_while.runs < 3) }}"
    pause: 0

Note: run iterations start at 0 so the above dataflow would render the following:

run0
run1
run2