Azure DevOps Task conditions
The below list will provide you list of task conditions available in YAML as well as Classic pipeline along with detailed examples on how to use them to run the tasks based on the conditions that was set in the pipeline. This feature enables you to run the tasks in job or in a stage or in different stage based on the conditions that has been set in the previous stages/jobs/tasks etc.,
By using the Task conditions feature
- We can run a task always even if any of the previous steps has failed
- We can run a task based on variables set in the previous tasks
- We can run a task based on whether the previous task has succeeded
- We can run a task even if the job or the stage is cancelled
Sometimes we may need to use a combinations of the task conditions as well as variables set to run some certain tasks. We can also use parameters set up in template but if the parameter is changed during the execution then the changed value of the parameter won’t be read by these task conditions. So we may need to be careful in using the parameters set in the template.
Note: This is only with respect to task conditions where as you can also have job as well as step conditions such that you can have one job to run depending upon another job and one step to run depending upon another step!