question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: Safest way to manually clean the build agent's work folder

See original GitHub issue

Have you tried trouble shooting?

Trouble shooting doc

Agent Version and Platform

Mainly 1.95.3 but also 2.123.0

Windows Server 2012 / Windows Server 2016

VSTS Type and Version

On-Prem TFS Tfs2015 Update3

What’s not working?

This is more a question. We run on-prem TFS2015 agent with the old 1.95.3 agent and have a LOT of repositories. We haven’t found any way to do global retention settings on the build agents, so the disk fills up over time. Until know we have recycled the build servers themselves now and then, but sometimes we need to do manual cleanup on the agents themselves. I’m just wondering what is the safest way to manually clean out the agents of old builds? Is it OK to delete stuff under _work, or does folders like _tasks need to be handles with care?

We are also running a few agents in the old VSTS (now AzureDevOps I guess) on version 2.123.0, can the same cleanup strategy be used here in a pinch?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:17 (5 by maintainers)

github_iconTop GitHub Comments

11reactions
TingluoHuangcommented, Oct 17, 2018

@andmos here is what i would suggest:

  1. rename the current _work to _work_bk (you can delete the entire _work folder, but backup the current work folder just in case).
  2. queue definitions that you really need them to work to the agent, the agent should should recreate the entire _work folder for you.
  3. if everything works fine, you can just delete _work_bk folder created in step 1.
10reactions
jawncommented, May 18, 2020

@jklemmack For Me: Organization Settings -> Agent Pools -> Select Your Agent Pool -> Settings

FYI, this is what the Maintenance job UI looks like

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Safest way to manually clean the build agent's work folder ...
yes, i would not suggest you to change/delete file within your work folder. the agent can't handle that. you can delete the entire...
Read more >
Azure DevOps - Clean build directory
I am using a self-hosted agent for running my build and release pipelines. A problem happens after I run a build and it...
Read more >
There is no way to clean workspace "after" a job in yaml ...
The job property has several options to clean workspace "before" job is run. But on self hosted agent it is valuable to be...
Read more >
Azure DevOps Clean after pipeline run
I have self-hosted build agents using Azure DevOps. We have the clean flag in the checkout step, however we run out of space...
Read more >
Managing Disk Space of Azure DevOps Self-Hosted Agents
Post Build Cleanup looks at your pipelines clean settings and will clean the working directories when the task is ran meaning – excellent!...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found