Step Status Conditional Workflow
status conditional workflow, you can configure a step to execute only if an input step’s status, during its current run, is satisfied. You can configure any number of statuses for a step.
It is important to note that only the status of an input step in the current run is considered for conditional workflows. If a step is not part of the current run, it is always assumed that the condition for that input step is met.
Adding Conditional Workflow for Steps
To add a conditional workflow for a step:
- In the
inputStepssection of a step, add the
- Add any of these values:
Ensure that the values are in lowercase and use the same spelling as shown above. Any deviation from this will cause the pipeline source sync to fail.
Example: In this example:
- step_B has only one status:
- step_c has multiple statuses:
Viewing Run Logs
When you run a pipeline, in addition to the other logs, the logs for steps with conditional workflow provide information about the skipped steps.
To view these logs, go to the Pipeline Run Logs view, click the skipped step to display the logs for the current run.
In this example:
- Step B is triggered only if step A succeeds (default behavior), and step C is triggered only if step A is in failed, error, or timeout status.
- Step B does not need any special configuration as the default behavior is to trigger a dependent step if the previous step succeeds.
- Step A also does not need any special configuration since the step itself does not decide the downstream workflow path.
In this example, Step S is triggered if Step Q succeeds and Step R fails. However, if both Step Q and Step R succeed or fail during the run, Step S is not triggered and it is skipped.
In this example, Step O is triggered if Step M succeeds and Step N fails. However, since Step N is not part of the current run, Step O is triggered when Step M succeeds and Step N's status is ignored.
Example 4 - Using Environment Variable
step_<inputStepName>_statusName, which is an environment variable that is automatically made available at runtime, can be used in conjunction with conditional workflows. This
step_<inputStepName>_statusName environment variable is useful for fetching the status of any input step, especially when working with Jenkins.