How to Retry a Failing Task in Azure Pipelines
Azure Pipelines re-runs a failing step automatically with retryCountOnTaskFailure.
Add retryCountOnTaskFailure to a task: or script: step. Azure re-runs that step up to that many times on failure.
Retry a flaky step
This step is retried up to twice on failure before the job is marked failed.
azure-pipelines.yml
steps:
- script: npm run test:integration
displayName: Integration tests
retryCountOnTaskFailure: 2Gotchas
retryCountOnTaskFailureretries only that step; it does not re-run the whole job.- It retries on any failure - do not put it on test steps where a real failure should stop the run.
- There is no built-in backoff; for delay-and-retry on a single command, script a bash loop instead.
Related guides
How to Retry a Failing Step in GitHub ActionsRetry a flaky step in GitHub Actions with a retry action or a bash loop with backoff, so transient network an…
How to Set a Job Timeout in Azure PipelinesSet a job timeout in Azure Pipelines with timeoutInMinutes, the zero-means-unlimited caveat, and cancelTimeou…