I have below main YML pipeline
And below is the template that is being called.
When trying to run the main pipeline is showing the error per below
I have below main YML pipeline
And below is the template that is being called.
When trying to run the main pipeline is showing the error per below
It looks that your condition is not met. So envname
is not sbx
and thus your template is skipped, and you can't run pipeline without any stage. Please make sure you have always at least one stage regardless of the result of the condition, or sth like empty stage for non sbx
env.
Agree with Krzysztof Madej.
When you add condition to the stages level, you need to make sure that there is at least one stage that meets the condition at all times.
In addition to adding an empty stage, you could also add the negative condition in the Yaml sample:
For example:
stages:
- ${{if eq(variables['envName'],'sbx')}}:
- template: test.yml
parameters:
buildSteps: test
- ${{if ne(variables['envName'],'sbx')}}:
- stage: Test
jobs:
- job: TestJob
steps:
- script: echo Test
displayName: 'Test Stage'
In this case, if the envName = sbx
, it will run the template, or it will run another stage.