@user18610347 I tested a similar setup, and here’s a version that works for me:
variables:
${{ if or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release')) }}:
branchName: 'master'
${{ else }}:
branchName: 'develop'
stages:
- stage: Build
jobs:
- job: BuildJob
steps:
- script: echo "branchName is $(branchName)"
Here is the pipeline for your review: https://dev.azure.com/nacho-chukwu/Infrastructure%20As%20A%20Code/_build/results?buildId=167&view=logs&j=a314f22c-0d8d-5f4e-2e5a-7023d7141778&t=afcbd69d-6218-5d12-27f7-cd8c790f2eca