We're using TeamCity, and I've set up jobs to pull from branches. But when those branches are deleted they still appear in Teamcity:
(List of outdated branches, but only refs/master
is actually active)
The Teamcity documentation actually specifies what constitutes an active branch:
Active branches
In a build configuration with configured branches, the Overview page shows active branches.
A number of parameters define whether a branch is active. The parameters can be changed either in a build configuration (this will affect one build configuration only), project, or in the internal properties (this defines defaults for the entire server). A parameter in the configuration overrides a parameter in the internal properties.
A branch is considered active if:
- it is present in the VCS repository and has recent commits (i.e. commits with the age less than the value of
teamcity.activeVcsBranch.age.days
parameter, 7 days by default).- or it has recent builds (i.e. builds with the age less than the value of
teamcity.activeBuildBranch.age.hours
parameter, 24 hours by default).- ! A closed VCS branch with builds will still be displayed as active during 24 hours after last build. To remove closed branches from display, set
teamcity.activeBuildBranch.age.hours=0
.
But... I don't understand their description! :) What do they mean with "parameters in the configuration"? I've tried making parameters in my jobs like so:
(Adding parameter teamcity.activeBuildBranch.age.hours
)
But that doesn't do anything. Maybe I'm exposing myself as a total TC noob, but can anyone guide me through how to correctly alter these settings so I only show repository-active branches in my build jobs?
To remove closed branches from display, set teamcity. activeBuildBranch. age. hours=0 .
In Git, branches are just pointers (references) to commits in a directed acyclic graph (DAG) of commits. This means that deleting a branch removes only references to commits, which might make some commits in the DAG unreachable, thus invisible.
The default branch allows using different branches in different VCS roots (for example, if one of the roots is Git and another is Mercurial) and in different builds when they are linked by a snapshot dependency.
I suddenly had success after adding parameters to the project configuration. Before now I've been adding parameters to individual builds and never saw a difference.. Maybe that's just me misunderstanding the obvious.
teamcity.activeBuildBranch.age.hours = 0 teamcity.activeVcsBranch.age.days = 1
This works in-so-far as the list of active branches is culled. There's still one deleted branch it considers active for reasons I can't yet decipher (history was rewritten several times in it), but at least all others are now inactive.
I had similar question when we first started using branches in TC.
As I recall the branches will stay visible until the conditions specified expire. It doesn't matter if the branch has been deleted, if it had commits in the last 7 days then it will stay visible for 7 days after the last commit even if it is deleted immediately.
So basically don't worry, they disappear eventually and I think you can lower the teamcity.activeVcsBranch.age.days
value if 7 days is too long to wait, but you will then lose branches that have no activity within that time I think.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With