I want to have multiple dependencies over a template. Is there a way to establish condition over the iteration of a parameter array ?
parameters:
deps: [Integration, Migration]
jobs:
- deployment: Deploy
displayName: 'Deploy'
dependsOn:
- ${{ each dep in parameters.deps }}:
- ${{ dep }}
condition:
- ${{ each dep in parameters.deps }}:
- in(dependencies.${{ dep }}.result, 'Succeeded', 'Skipped')
environment: QA
strategy:
runOnce:
deploy:
steps:
- bash: |
echo "Deploy dev"
This one is marked as (Line: 12, Col: 3): A sequence was not expected
The error is caused by below condition:
Above yaml will be evaluated to :
Condition cannot accept a sequence of expressions. Multiple expressions should be joined with
and,ororxor. See here for more information.You might have to evaluate the condition outside the template.
For example, add an additional job in your azure-pipelines.yml to depend on the above jobs: See below:
Then you can just check the status of job CheckStatus in the template: