Resource collision in Azure Devops Pipeline

The system I’m working with is using a private agent pool rather than hosted.

Roughly, my yaml defined procedure is the following and each step is dependent on the last:

  1. Build (to check for build failures)
  2. Test
  3. Deploy (I simply build and output the files into another predefined folder of servers on the local network)

The Issue in Detail

For different pipelines, the devops service is able to create different folders for each pipeline and I have little issues. However, regarding on the subject matter of different branches on the same pipeline; the issue I am running into is that if the CI/CD trigger gets scheduled too closely, the build and test directories for the pipeline will race condition causing at least one of the runs to fail. Furthermore, they can also interfere with each other’s “deploy” if the build tries to write to the same remote folder.

  • Is there a way to define a separate workspace for each branch so that building and testing happens in isolation from other runs?
  • Is there some sort of locking system I can implement so that only one
    job can execute my entire pipeline job atomically?


Scouring through the DevOps documentation, it appears you’re not supposed to be able to define the output folders or workspace folder through normal means.

I tried using the Exclusive Lock feature, but couldn’t find any documentation or examples on how to make this work with my pipeline (I instead, found an open issue on the Microsoft documentation GitHub saying the documentation was missing). It is my understanding this feature is extremely new.

I also noticed that the Hosted Agents use a separate vm container for each run that largely eliminate resource collision. Are we supposed to setup something similar on the private agent?

For reference, I am relatively new to Azure DevOps.

Go to Source
Author: Bennett Yeo