Documentation is extremely scarse on this (https://learn.microsoft.com/en-us/vsts/build-release/actions/agents/v2-windows?view=vsts#download-configure)
How to install VSTS agent on C, but keep workdir on other drive?
How to force VSTS agent to reclaim space or limit agent to X gb?
It's able to change the working directory to another drive.
For the new build agent, when you run .\config.cmd
command, there is a step called:
Enter work folder (press enter for _work):
You could change the path here.
The default work folder location is a
_work
folder directly under the agent installation directory. You can change the location to be outside of the agent installation directory, for example:D:_work
.
For a existing build agent, you could remove and re-configure an agent. Delete the old working folder will not break the agent.
You could refer this blog as a tutorial(For TFS but similar to VSTS).
How to force VSTS agent to reclaim space or limit agent to X gb?
You could not do this for local agent. There is no such setting in agent capabilities.
If you need this feature, Hosted agents offer 10 GB of space.
If you are worrying about the disk space:
Build.Clean
variable to all, it will clear the directories before pulling sources.$(Agent.BuildDirectory)
and $(Build.SourcesDirectory)
variables are useful for this. It will delete files after built successfully.For more info please refer: Clear the work folder after each build?