Reputation: 69
I am currently working on azure pipeline with multiple stages created dynamically based on the input parameter(s), and want to run the stage2_stg_x in sequence rather than parallel(currently it runs in parallel). I couldn't found any possible solution to get that achieved.
Could someone suggest here.
main pipeline : test.yml
trigger: none
pool:
name: 'linuxagent'
parameters:
- name: appComponents
displayName: YAML list of Components to Build and Deploy
type: object
default:
- stg_a
- stg_b
- stg_c
- stg_d
- stg_e
stages:
- template: pipeline/stages/stage1.yml
- ${{ each appComponents in parameters.appComponents }}:
- template: pipeline/stages/stage2.yml
parameters:
appComponents: ${{ appComponents }}
stage1.yml
stages:
- stage: stage1
dependsOn: []
displayName: stage1
jobs:
- job:
steps:
- bash: |
# Write your commands here
echo "Hello world"
echo "i am here"
stage2.yml
parameters:
- name: appComponents
displayName: "Component name"
type: object
stages:
- stage: stage2_${{ replace(parameters.appComponents, '-', '_') }}
dependsOn: stage1
displayName: stage2 For ${{ parameters.appComponents }}
jobs:
- job:
steps:
- bash: |
# Write your commands here
echo "Hello world"
echo "i am here"
Note : Here i have just using the basic echo for testing purpose. But my actual pipeline has different logic.
Upvotes: 3
Views: 3776
Reputation: 99
Try removing "dependsOn" from all your stages. I have a similar setup and the stages all just depend on the stage before them.
Upvotes: 1