Search code examples
azure-devopsazure-devops-self-hosted-agent

How to control work folder for Azure DevOps pipeline?


Normally, if you are using a self-hosted Azure agent, it automatically selects target folders for you (I assume based on pipeline name), underneath the work folder... so for example:

/home/xxxxx/azure/_work/2/t/

Is there a way that I can control this choice from a YAML pipeline? My use case is that I have a very large repo, and several different pipelines that all check it out. I only have one agent running on the machine, so my preference is that all of the pipelines I run on this agent check out into the same folder (like /home/xxxxx/azure/_work/MyProject), ensuring that there will only be one checkout of this large repo.


Solution

  • You could avoid syncing sources at all in the pipeline by setting checkout: none:

    steps:
    - checkout: none
    

    Then add a command line or script task to clone the repo manually via git commands.