Chris Straw
SHARE:

Azure DevOps Build Agent Cleanup

One of our Linux build servers for Azure DevOps ran out of drive space. After some discovery of what was taking the drive space, I found two primary locations consuming a majority of the drive space

Stop Service

sudo systemctl stop azure-pipelines-agent.service

NuGet Cache

In my case, the NuGet packages were under the user directory ~/.nuget

rm -rf ~/.nuget/packages

Azure Agent dotnet SDKs

~/myagent/_work/_tool/dotnet/sdk

rm -rf ~/myagent/_work/_tool/dotnet/sdk/6.0.*
rm -rf ~/myagent/_work/_tool/dotnet/sdk/7.0.*
rm -rf ~/myagent/_work/_tool/dotnet/sdk/8.0.100*

# OR
rm -rf ~/myagent/_work

Commands to find Drive Space Usage

 du -h --max-depth=1 | sort -h
df -h --total