You can use return
in the main workflow to stop a workflow's execution. You
can also finish a workflow by simply completing the final step (assuming that
the step doesn't jump to another).
A workflow's execution stops when one of the following occurs:
- An error is raised and not caught
- After all steps have been executed
- When the keywords
end
orreturn
are used in the main workflow
Use end
In the main workflow, you can use next: end
to stop a workflow's execution if
you don't need to return a value. A main workflow that executes a next: end
step completes with null
as the result.
In a subworkflow, you can use next: end
in a step to make it the last step in
the subworkflow and return null
. It does not need to be in a separate step
(unlike return
) and can be used in any step. When using either next: end
or
return
, control is returned to the calling subworkflow.
YAML
- STEP_NAME: ... next: end
JSON
[ { "STEP_NAME": { ... "next": "end" } } ]
Use return
Use return
to stop a workflow's execution and return a value, variable, or
expression:
YAML
- STEP_NAME: ... return: ${VARIABLE}
JSON
[ { "STEP_NAME": { ... "return": "${VARIABLE}" } } ]