I’m currently migrating an existing CI/CD pipeline build in Azure DevOps from the ‘classic’ build approach to YAML templates.
One of the things I had to do was find out a way to run multiple stages in parallel. In the original pipeline code was deployed to multiple environments at the same time and I needed something similar when using YAML templates.
By default when you define multiple stages in a pipeline, they run sequentially in the order in which you define them in the YAML file. The exception to this is when you add dependencies. With dependencies, stages run in the order of the dependsOn
requirements.
We can use this to our advantage to run 2 stages in parallel. Here is the yaml file we used:
Notice the dependsOn
we use in the ‘Acceptatie_Extern’ stage. This will trigger both the ‘Acceptatie’ and ‘Acceptatie_Extern’ stage after the ‘Development’ stage.
And here is how the final pipeline looked like: