How to clean up builds triggered by git tag?
I setup a build configuration in Teamcity so that a build can be triggered by tagging a commit in git (tag names are shown in "Branch" column):

I also have to configure parameter "teamcity.activeVcsBranch.age.days" to be 50 because in my project there is a need to tag older commit. So a tag/branch will be "Inactive" branch after 50 days in Teamcity
I want to keep the latest 5 builds only in this build configuration (their triggers might still be "Active" branches). I configure clean-up rules as below:

This clean-up rule doesn't work and it seems the reasons are that Teamcity treats tag as branch and https://www.jetbrains.com/help/teamcity/2022.04/teamcity-data-clean-up.html#Base+Rule+Behavior+for+Build+Configurations+with+Feature+Branches.
Instead of "TeamCity creates one group per each active branch", can Teamcity create one group for all active branches then apply clean-up rules? I think that will solve the problem I got. Or could you please suggest other solutions?
Please sign in to leave a comment.
Hello Tim,
May I suggest that you create a feature request in Youtrack regarding this functionality?
Regarding your issue, when defining a keep rule, wouldn't it be an option for you to specify in the Branches the tags/branches that you want to include/exclude combined with the "Apply rule" that you can set as in the screenshot below?
Thank you,
Guilherme
Hello Guilherme,
I don't want to preserve anything when cleaning up a build so I didn't add any "Keep rule" and configurated anything there. Is my understanding correct?
Hello Tim,
Keep rules allow you not only to define which data you want to keep or delete, but as shown above, also to filter builds by branches, tags, etc.
So it seems it might help you with your question above. Maybe you already know it, but if not, the following documentation might help you understand better what can be done with the Keep rules:
https://www.jetbrains.com/help/teamcity/teamcity-data-clean-up.html#Keep+Rule
Thank you,
Guilherme