Clean-up rules problem


I'm having a problem with clean-up rules not cleaning up build history as I would expect.

I have set up clean-up rules as follows on the root project:

  1. Base rule - Disabled
  2. Keep rule - Preserve History and Statistics only, for all builds (applied to all branches as a set). Don't keep artifact dependencies.
  3. Keep rule - Preserve Everything (History, Artifacts, Logs and Statistics), for builds 30 days before last successful build (applied to each selected branch). Don't keep artifact dependencies.

With these rules, what I expect should happen is that any builds under 30 days since the last successful build on any branch should keep everything (as per #3), and any remaining builds (i.e. older than 30 days) should retain only the history and statistics (deleting artifacts and logs) (as per #2).

We have build chains with snapshot and artifact dependencies. I can see that builds at the end of the chain are having these rules applied as expected (history remains, but artifacts and logs are deleted), but builds within the chain are only having their artifacts deleted (logs are not cleaned).

This is causing issues because the build logs are now what is occupying the vast majority of the disk space.

Is this the expected behaviour here, or am I doing something wrong?


Hi Sam,

It is by design that the logs of the snapshot dependencies aren't cleaned up until the dependent builds are not removed. Some versions had this the other way around (see this bug), but normally the logs will only be cleaned up when there aren't any builds which are snapshot-dependent on the build in question. By the way, the same goes for the build history.


Register for TeamCity Technology Day - Nov 5th 


Hi Anatoly,

Thanks for the clarification.

Is clean-up of logs for builds with snapshot dependencies something that could be considered for inclusion in TeamCity?

As it currently stands, the new clean-up rules (a) don't seem to behave in the way the UI leads you to expect, and (b) are pretty much useless for us in terms of being able to select not to keep logs (as many of our builds are part of a snapshot chain, and as such will never have their logs cleaned up).


Related to the above, it would be nice to also be able to delete other hidden artifacts as part of clean-up too (in our case specifically, the .teamcity/.NETCoverage folder which contains detailed code coverage output, which also takes up quite a bit of disk space)


Sorry about the delay.

To clean up the builds which have dependent builds, those dependant builds need to cleaned up first. Please ensure the dependent builds have their clean-up policies configured properly.

Regarding the hidden artifacts clean-up, as mentioned in the documentation, to clean up the hidden artifacts, .teamcity has to be explicitly specified in the artifacts pattern in the clean-up rule settings.

UPD: also you might want to upvote this feature request:


Is there a feature request specifically to allow the cleanup of logs of dependent builds? TW-2068 is only about providing visibility, not actually enabling those logs to be deleted.


Please sign in to leave a comment.