Guide on Implementing ContinueOnError in Azure DevOps for Task Failures
Introduction
At times, you might encounter Pipeline Tasks relying on third-party APIs that are beyond your control. When such Tasks fail due to issues with the third-party APIs, it can lead to the failure of your entire pipeline. The uncertainty of when the issue will be resolved adds to the challenge. However, the invocation of the third-party API may not be crucial for your upcoming release.
Solution
In situations like this, it is beneficial to allow the execution of subsequent Tasks to proceed. This article explains how to enable the continuation of a pipeline’s execution even if a specific Task fails, using the ContinueOnError property.
Let’s create a pipeline with multiple tasks and intentionally introduce an error in one task, as demonstrated in the example below.
From the screenshot above, observe the following:
- The task named “Not So Important Task” contains an intentional typo (using “Write-Hosts” instead of “Write-Host”) to simulate an error.
- An attribute called continueOnError has been incorporated to overlook errors during the pipeline execution.
Upon running the pipeline, you will receive an error indication for the Task, and the execution will progress as illustrated below.
Summary
This blog post has elucidated how to allow the pipeline’s execution to continue despite errors in specific tasks. This straightforward technique is useful in scenarios where a non-essential task encounters intermittent failures, and you wish to proceed with the pipeline execution.
If you have any queries, please feel free to comment below. Thank you for reading.
To know more about Skrots and our services, visit us at Skrots. Explore a wide range of services we offer at Skrots Services. Don’t forget to check out our other blogs at Blog at Skrots
Know more about our company at Skrots. Know more about our services at Skrots Services, Also checkout all other blogs at Blog at Skrots
Thanks, Harsh
Founder | CEO — Skrots
Learn more about our blog at Blog at Skrots. Checkout our list of services on Skrots. Give a look at our website design at Skrots . Checkout our LinkedIn Page at LinkedIn.com. Check out our original post at https://blog.skrots.com/how-to-use-continueonerror-in-azure-devops-for-task-failure/?feed_id=5442&_unique_id=6603d56a7d3d9