How to trigger by branch to use specific template under "stages"?
trigger:
branches
include:
- ci
- prod
stages:
template: ci.yml
condition: and(eq(['build.sourceBranch'], 'ci'))
template: prod.yml
condition: and(eq(['build.sourceBranch'], 'prod'))
Tried above condition but didn't work. I was getting "unexpected value condition". Any help is appreciated
***** Tried one of the solution as by passing condition as parameter to the template:
stages:
template: ci.yml
parameters:
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/ci'))
template: prod.yml
parameters:
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/prod'))
Getting "unexpected parameter condition"
Pipeline structure:
master.yml (contains runtime parameters) stages:
template: ci.yml
parameters:
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/ci'))
template: prod.yml
parameters:
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/prod'))
ci.yml
stages:
stage: BuildApp
stage: BuildWeb
stage: DeployLocal
prod.yml
stages:
stage: BuildApp
stage: BuildWeb
stage: DeployProd