I'm trying to add an optional set of parameters when the build running is not on the master branch. The idea is that azure-pipelines-template-variables-private.yml overrides just some of the parameters contained in the group.
This is my template file:
stages:
- stage: "Tests"
variables:
- group: MyLibrary
${{ if ne(variables['Build.SourceBranchName'], 'master') }}:
- template: azure-pipelines-template-variables-private.yml
This returns the error "Expected a mapping"
Without the if block the behaviour is as expected - the parameters are overwritten. I'm struggling to understand how if blocks work. The docs show how to use variables with Group and variables with templates - but not both together. Though it seems to work together, so I would expect the if statement to work.
Edit: For information I'm including the variable template contents:
variables:
- name: MyVar1
value: 'TEST-$(Build.BuildId)'
- name: MyVar2
value: '/Builds/$(BUILD.BUILDID)'