I have an issue with a variable evaluating to Null on a Condition.
This is the pipeline:
I have a variable template that is pulled in by the main yml file:
variables:
- ${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/feature/') }}:
- name: is_sandbox
value: true
- ${{ if eq(variables['system.pullRequest.targetBranch'], 'refs/heads/master') }}:
- name: is_sandbox
value: true
- name: bob
value: a
Note that is_sandbox is not set anywhere else.
I then have a condition on job:
condition: or (eq(variables.is_sandbox, true), eq(variables.bob, 'a'))
But this fails to evaluate. In the log is see:
system.pullRequest.targetBranch : refs/heads/master
and:
Expanded: or(eq(Null, True), eq(Null, 'a'))
Result: False
So it appears that the variables template has not set correctly. Why would that be?