Azure Pipelines useful conditions

Written on May 6, 2020

For my own reference as much as anything, here’s a few Azure Pipelines conditions I’ve found useful:

Azure Pipelines

Only run this task when building master

  condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))

Only run this task when building a pull request branch

condition: contains(variables['Build.SourceBranch'], 'refs/pull/')

Only run this task when System.Debug variable has been set

condition: eq(variables['System.Debug'], 'true')

If I come across others, I’ll update this post with them.

Categories: Azure Pipelines