Reputation: 838
I am running into an issue where I'm trying to execute the following logic on the stage
condition
In plain text, it should work like this:
(branch is release AND var undefined) OR (branch is release AND var == sys)
The way I'm trying to do that in my YAML is like this:
# SYS
- stage: BuildSYS
condition: or(and(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), eq('[variables.Env]', '')), and(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), eq('[variables.Env]', 'SYS')))
jobs:
- job:
steps:
- script: echo Hi form SYS!
Env
in this case is a variable that I pass into the pipeline.
I am on a release/*
branch when I trigger, so I'm not sure what I'm doing wrong.
Upvotes: 1
Views: 943
Reputation: 40879
Here '[variables.Env]'
is the issue. Please repleace it to variables['Env']
.
So your condition should be:
condition: or(and(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), eq(variables['Env'], '')), and(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), eq(variables['Env'], 'SYS')))
Upvotes: 2