Make VSTS agent use the same “Working Directory” e

2019-08-30 13:00发布

问题:

I have a VSTS local agent that runs a "Get Sources" build task, which causes the GIT repository to be downloaded. This works fine.

Unfortunately, my GIT repository is over 20 gigs in size. I have the "Get Sources" task set to not do any cleanup, because I want to prevent subsequent GIT downloads to not have to download the entire 20 gig repository every time.

Today, I noticed that the agent switched the working directory from

C:\agent_work\1

to

C:\agent_work\2

which caused the entire repository to be re-downloaded again when the "Get Sources" build task executed.

What is method by which the Build Agent decides what the "working directory" resolves to and is there a way to force the agent to use the same directory?

I really can't afford the time to download 20 gigs every time I need to do a deployment.

I have no tagging or branching going on in the repository. It's fairly straight forward aside from the size.

Thanks in advance!

回答1:

Each build definition goes into its own directory within the agent's working directory.

This is intentional, cannot be changed, and should not be changed. The reason it behaves this way is to support the ability to build concurrently -- multiple running builds sharing the same copy of the repository are guaranteed to step on each other sooner or later.

Synchronizing the repo will only happen once per build definition per agent.