Azure DevOps pipelines: skip on error

How to continue with the Azure DevOps workflow even if a step fails

In our case we want to continue with the CI / CD pipeline if a specific step or job fails, e.g. the karma tests for the frontend.

- task: Npm@1
  displayName: Test frontend
  continueOnError: true
  ...
- task: Npm@1
  displayName: Build frontend Prod
  condition: succeededOrFailed() # continue even if previous tests failed

The 2 instructions that we use are:

  • continueOnError: true for the task that can fail.
  • condition: succeededOrFailed() for the task that follow the one that could fail.

continueOnError The step or job is annotated with a yellow warning sign because there are issues in this step but the pipeline continue to the next step.

succeededOrFailed it starts even if the previous job failed