0

I use a self-hosted build agent for my Azure DevOps Git rep so the build tree lives on my local build machine in a local folder like c:\agent\work\24.

I recently created a permanent branch from my master for release. I'd like to be able to build either branch of the pipeline independently and have both build results/work-folders stored on the local build machine. But unfortunately, Azure wants to use the same subfolder for both builds

Is there any way to make the new branch version of the pipeline use a different subfolder (e.g. c:\agent\work\25)? I'd like to avoid editing any existing pipeline YAML (unless there's some line I can put in there to just change the subfolder, of course)

Joe
  • 5,394
  • 3
  • 23
  • 54
  • Can you explain why this matters? The agent's behavior with how it maintains working directories shouldn't be something you have to concern yourself with; if it is, chances are there's a larger issue at hand. Are you concerned about caching? If you provide a bit more detail on the root cause of you asking this question, the community might be able to guide you to a good solution to the root cause. – Daniel Mann Sep 23 '21 at 18:15
  • It matters because I want to be able to have both builds, side-by-side with caching on my local build box. If I could do this without having to create a new pipeline, that would be great. Sounds like you're saying I can't. I can live with that, just wanted to avoid it. The solution seems clear: Create a new pipeline – Joe Sep 23 '21 at 19:33
  • Or use the built-in caching capabilities: https://learn.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops – Daniel Mann Sep 23 '21 at 19:35
  • That does seem to get me caching, so thanks I did not know about that. Does not appear get me side-by-side builds though, unless I'm missing something. I was hoping to just change some one-line setting somewhere and be able to come in the next day after a nightly build has gone off and have both builds, sitting there waiting for me to inspect if either has gone wrong. If I need to create a separate pipeline to get that (or edit my existing one and start debugging it to make sure I got it right) the caching doesn't buy me much right now. – Joe Sep 23 '21 at 19:42

1 Answers1

0

Is it possible to change the local subfolder that Azure Pipelines uses with a Self-Hosted Agent?

It is impossible to change the local subfolder that Azure Pipelines uses with a Self-Hosted Agent.

According to the document Agent variables:

enter image description here

So, each build definition goes into its own local subfolder named with a recursive number.

We could only change the work folder but the subfolder based on the hidden .agent file in the installation directory:

{
  "agentId": 9,
  "agentName": "VsAgent1",
  "poolId": 10,
  "serverUrl": "https://dev.azure.com/MyXXXXOrganization/",
  "workFolder": "_work"
}

As we can see, we could onr change the workFolder.

You could check the this thread Change Variable Pipeline.Workspace in Azure Devops for some more details.

So, the solution for this issue is create a separate pipeline.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135