With the release of 8.3, came the ability to call sub-pipelines within a task of a Pipeline or release. You can call a pipeline by going to a Task and selecting ‘Pipeline’.
You will need to select the Sub Pipeline’s Project and name. The final two options control the behavior of the ‘Calling Pipeline’.
The last two fields should be changed based on the use Case for the pipeline. Here are a few examples of the different combinations of the last two fields and the use cases they can be used for.
Continue on Error and Running Asynchronously
- For the Default setting, as shown above, the ‘Calling Pipeline’ will continue regardless of the status of the sub-pipeline One use case for this set up would be sending out Notification Emails for a running pipeline. If you would like to send out a notification that Pipeline started and do not want to have the calling pipeline wait for the sub-pipeline to finish and not stop if the sub-pipeline hits an error, then you can set the field to Continue the calling pipeline on Error Or Rejection and Run Pipeline Asynchronously.
Stopping on Error and Running Synchronously
- Alternatively, If the Calling-pipeline is dependent on the Sub-pipeline and you want the Calling-Pipeline to wait for Sub-Pipeline to finish before moving on, you can use Stop the calling pipeline on Error Or Rejection and Run Pipeline Synchronously. This will have the Calling-Pipeline wait until the Sub-Pipeline is complete before moving and will error out if the Sub-pipeline encounters an error. An example use case for this, would be a Calling-pipeline using a sub-pipeline to set properties. These properties should be necessary for the calling-pipeline to complete, therefore the Calling-pipeline must wait for the sub-pipeline to complete without errors.
Stopping on Error and Running Asynchronously
- If you want the Pipelines to run Asynchronously but still be able to use Stop the calling pipeline on Error Or Rejection, you will need to have the calling pipeline or a task within the calling-pipeline be aware of the Status of the sub-pipeline at a later point in the pipeline. You can do this by adding a Wait Dependency.
Wait Dependencies can be found by selecting the ‘Conditions’ within a Menu of an Task, Stage, etc.
A Wait Dependency allows you to Wait for all triggered pipelines or releases, or define a specific Pipeline or stage to wait for.
By setting a Wait Dependency, the Task or stage will wait for the Sub-Pipeline to finish. If the Sub-pipeline errors out, then the calling pipeline will also error as well. In this case, you can have the Pipelines run in parallel but the overall result will still show an error if there is an error on either pipeline.