CloudBees CD steps can have a success , warning , error , or skipped outcome. Sometimes it is useful to execute or skip subsequent steps based on the outcome of a previous step. Used with error handling behavior available at the step level, sophisticated flow control can be achieved easily.
This tutorial demonstrates how to see the outcome of a preceding step and use run conditions to execute steps based on that outcome.
To view an example procedure for this tutorial , go to the automation platform UI > Projects > EC-Tutorials- <version> , and click the procedure name.
An explanation of what you see:
The Procedure Details page for the procedure, "Checking outcome of preceding step", contains 3 steps:
step 1—force an error—This step forces an error by attempting to run on a resource that does not exist. This action was achieved by hard-coding the step named
"step 1 – force an error"to run on a resource called "
Click Run to run this sample procedure and see the resulting job status on the Job Details page.
Use the following instructions if you would like to practice creating steps to check the outcome of a preceding step.
|Any changes you make within this tutorial will not be saved when you upgrade CloudBees CD and you cannot transfer any steps from this tutorial to your projects. These instruction are provided only to give you a clearer definition for how to recreate this process in your own projects.|
Click the Create Step link.
In the Choose Step Type dialog, choose Command step to go to the New Step page.
Enter a Name for your step.
Repeat this process to create 3 steps, clicking OK to save each step.
When your 3 new steps are displayed on the Procedure Details page, click Run to see your steps running on the Job Details page.
Step —create new or edit existing step —Help topic