Does TeamCity auto delete old checkout directories?

Does TeamCity 8.1 auto delete old checkout directories? We have many build machines and branches. Some of the branches are very large (couple hundred GB). I try to keep even rarely used branches synced on the builders in case we suddenly need to build from that branch.

Lately I've noticed that some of the build machines seem to be missing branches that I'm sure were synced there in the past. We even have a couple machines that were dedicated to a single branch, but haven't been needed in a few weeks. I looked at them today and their work directories are completely empty, except for the .old folder and directory.map file.

I've searched the settings and docs but cannot find any mention of this. Does anybody know what's going on here?

4 comments
Comment actions Permalink

In "Automatic Checkout Directory Cleaning" on Build Checkout Directory is described when the checkout directory will be deleted.

0
Comment actions Permalink

Thank you. That has been helpful.

Before I mark this thread as answered, I'm hoping to get a bit more info on how this mechanism is implemented.

From my testing, I've inferred the following: The expiration time for a particular checkout directory of a particular agent is only propogated when a build is run on that particular agent using that particular checkout directory.

For example:

  1. Expire time is set to 1 hour (set globally by defining system.teamcity.build.checkoutDir.expireHours for root project).
  2. Run a build on Agent 2 using checkout directory B (this particular checkout directory's expire time is now set to 1 hour).
  3. Run a build on Agent 2 using checkout directory C (this particular checkout directory's expire time is now set to 1 hour).
  4. Change expire time to 2 hours in root project.
  5. Run a build on Agent 2 using checkout directory C (this particular checkout directory's expire time is now set to 2 hours).
  6. In 1 hour, checkout directory B on Agent 2 will be deleted, dispite changing it to 2 hours in root project.
  7. In 2 hours, checkout direcory C on Agent 2 will be deleted.


The important note here as that simply setting the expiration time globally will not actually change the expiration time for any checkout directories unless they get used again. So if your goal is to prevent old checkout directories from being deleted from all your agents, you must both set the expiration time to "never" and use every single checkout directory again on every single agent to propogate the new expiration time.

Have I inferred the behavior correctly?
If so, is there any way to prevent deletion without re-using every single checkout directory on every single agent?

0
Comment actions Permalink

Hi Matthew,

Now it works exactly as you described. So for now the solution is to restart all build on all agents (to check the current value you can use buildAgent/work/directory.map file, but it is not recommended to modify it).
We've created the issue to change this behavior - https://youtrack.jetbrains.com/issue/TW-39977. After fix: if you set teamcity.agent.build.checkoutDir.expireHours for agent, then default value will be written to the directory.map file for all checkoutDirs. Default value will be equal to the current value of teamcity.agent.build.checkoutDir.expireHours option (instead of 8 days as it is now).

0
Comment actions Permalink

Thank you for clearing that up.

I have some thoughts on the proposed solution. I'll add them to the tracker.

0

Please sign in to leave a comment.