In this article, we are going to learn about a simple tip on how to continue the Pipeline execution even when a non-critical Task is failing for some reason.
Sometimes, you many have some Pipeline Tasks which may be dependent on third party APIs on which you wouldn’t have much control. In these scenarios, if the Task is failing (or may be failing intermittently) due to a load/bug in the third party API, your entire pipeline would fail. You don’t have any insights about when the bug would get fixed. May be, invoking the third party API might not be very important for your upcoming release.
In this case, it absolutely makes sense to continue the execution of the next set of Tasks. In this article, we are going to learn how to continue the execution of the pipeline if a particular Task has failed by using ContinueOnError property.
Let’s build a pipeline with few tasks where we simulate and error in one of the tasks as shown below.
As shown in the above screenshot, the following points to be noted.
- The task named Not So Important Task, an intentional typo (instead of Write-Host, I used Write-Hosts) has been introduced to simulate an error.
- An attribute called continueOnError has bee added to ignore if there any errors while executing the pipeline.
Now, when you run the pipeline, an indication about the error for the Task is shown and the execution will carry forward as shown below.
In this blob post, we have learnt how to continue the execution of the pipeline inspite-of having an error in one of the tasks. This simple technique can be used in scenarios where you have a non-mandatory task that’s failing intermittently and you want to continue the execution of the pipeline.
Feel free to comment in the below section if you have any questions. Thanks for reading.
Do you like this article? If you want to get more updates about these kind of articles, you can join my Learning Groups