Azure DevOps Multi-Agents strategy with Multistage pipeline – Part 2

As mentioned and the last article on how to build software for a cross-platform and needed to build and test it on different operating systems?

This time, I will demonstrate the same thing, but in an isolated step in the Multistage pipeline.

What we do here, is follow the same multistage pipeline as the last article, but will not use strategy and matrix, we will in sted define separate stages for each operating system agent and make the next stage depending on all of the agents success before continuing.

Let’s show it:

trigger:
- main

stages:  
- stage: Build  
  pool:
    vmImage: ubuntu-latest
  jobs:  
  - job: BuildJob  
    steps:  
    - script: echo Building
- stage: TestWithLinux
  dependsOn: Build
  pool:
    vmImage: ubuntu-latest
  jobs:  
  - job: Testing
    steps:
    - script: echo Test with Linux OS
- stage: TestWithWindows
  dependsOn: Build
  pool:
    vmImage: windows-latest
  jobs:  
  - job: Testing
    steps:
    - script: echo Test with Windows OS
- stage: Final
  dependsOn: [TestWithLinux,TestWithWindows]
  pool:
    vmImage: ubuntu-latest
  jobs:  
  - job: FinalJob
    steps:
    - script: echo Final Job

as you can see there are 2 separate stages that only can continue to the final if both pass the stage as you can see in the visual pipeline.

To see a list of fully supported agents, check this link.

That is it.

Conclusion

With this article and the previous article, we have learned both a little bit about how to create a multistage pipeline, and how to run software on different operating system agents.

There is no right or wrong how to achieve this, it all depends on your project requirement and strategy of doing this. Each has its own cons and pros that I will leave to you to find out.

Leave a Comment