What is the easiest way to make Azure pipeline stage fail for debugging purposes

Advertisements

I would like to make a given stage fail to test my conditions

- stage: EnvironmentDeploy
  condition: and(succeeded()...)

is it possible to make - stage to fail purposefully?

>Solution :

The easiest way I can think of is adding a job with a PowerShell script, and using the throw keyword to exit the script with an error:

stages:
- stage: StageToFail
  jobs:
  - job: JobToFail
    steps:
    - pwsh: throw "Throwing error for debugging purposes"

Leave a ReplyCancel reply