Problem
TeamCity clean-up rules may appear to be configured correctly, but old builds, artifacts, or logs are not removed as expected. In some cases, builds significantly older than the configured retention period remain in the system.
For example, builds older than several months/years may still exist even though clean-up rules should remove them.
Possible Causes
Several factors may prevent TeamCity from cleaning up builds as expected:
Base Rule Configuration The base clean-up rule may be configured to preserve data younger than a specific threshold (for example, preserving all data newer than 361 days). If the configuration preserves builds based on this rule, the system will not remove them.
Conflicting Clean-up Rules Conflicts between Base Rules and Keep Rules can prevent builds from being removed. TeamCity prioritizes rules that preserve data, meaning restrictive keep rules can override clean-up rules.
System Interruptions The clean-up process may be interrupted by other system processes such as:
- Server backup operations
- Clean-up timeouts
- Server restarts or interruptions
These events can prevent the clean-up process from completing successfully.
Investigation Steps
1. Verify Clean-up Rule Configuration
Review the clean-up rules configured for the affected project.
- Check the Base Rule configuration.
- Ensure there are no Keep Rules preserving builds that should otherwise be deleted.
For example:
A rule such as “Clean everything more than 361 days older than the last build” will not delete builds if other rules preserve them.
Use the Clean-up Diagnostics tool to generate a report explaining why specific builds were not removed.
The diagnostics report can help identify rule conflicts or conditions preventing clean-up.
2. Review Server Clean-up Logs
Inspect the teamcity-cleanup.log file for details about the clean-up process.
Location:
Administration → Diagnostics → Server Logs
Look for entries such as:
Removed 3 log files in directory:
/data/teamcity_server/datadir/system/artifacts/<BuildConfiguration>/<Path>
These messages confirm that clean-up has been executed for certain configurations.
If expected builds are not referenced in the log, the clean-up rules may not be applying to those builds.
3. Check for Timeout or Backup Interruptions
Clean-up tasks may stop if they exceed configured timeout limits or if server backups begin during the process.
To test this scenario:
- Navigate to Administration → Clean-up Settings
- Temporarily remove or increase the timeout limit
- Run the clean-up process manually
- Monitor the process until completion
After testing, restore the timeout settings to their original values.
Refer to the TeamCity documentation for additional details on clean-up timeouts.
4. Generate Diagnostic Data for Further Analysis
If builds that should be removed are still present:
- Tag one of the affected builds
- Generate a Clean-up Diagnostics Report
- Collect the following logs:
teamcity-cleanup.logteamcity-server.log- Diagnostic report output
These logs can help determine why the clean-up rules are not being applied.
Current Status
The behavior described above may occur due to rule configuration conflicts or system interruptions. However, in cases where the configuration appears correct and builds are still not removed, further investigation may be required.
This issue may need to be escalated internally for deeper analysis of the clean-up process.
Recommendations
- Verify clean-up rules and ensure there are no conflicting Keep Rules.
- Use the Clean-up Diagnostics tool to identify rule conflicts.
- Monitor
teamcity-cleanup.logduring clean-up execution. - Ensure that server backups or timeouts are not interrupting the clean-up process.
- If the issue persists, escalate internally with full diagnostic logs for further investigation.
Comments
0 comments
Please sign in to leave a comment.