I am trying to implement a multi-stage pipeline in azure devops that is running everytime a push is committed all branches.
But, I would like to skip a certain stage in executing a pipeline stage using condition, given certain branches
Here is the initial script:
jobs:
- job: JOB A
variables:
protected_branches: master, main
condition: containsValue(variables['protected_branches'], variables['Build.SourceBranchName'])
Seems this script is not working
Thank you!
Since variables in Azure DevOps pipelines can only be defined as strings, you should use
containsinstead ofcontainsValue.Here is a code sample where I trigger the pipeline from a branch named
test-pipeline:Output: