停止 Teamcity 显示已删除的分支

Stop Teamcity showing deleted branches

我们正在使用 TeamCity,我已经设置了从分支机构提取的作业。但是当这些分支被删除时,它们仍然出现在 Teamcity 中:

(已过时的分支列表,但实际上只有 refs/master 处于活动状态)

Teamcity documentation实际上指定了什么构成活动分支:

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.

但是...我不明白他们的描述! :) "parameters in the configuration" 是什么意思?我试过像这样在我的工作中制作参数:

(添加参数teamcity.activeBuildBranch.age.hours)

但这没有任何作用。也许我将自己暴露为一个完全的 TC 菜鸟,但任何人都可以指导我如何正确更改这些设置,以便我只在我的构建作业中显示存储库活动分支?

刚开始在 TC 中使用分支时,我也有类似的问题。

我记得分支将保持可见,直到指定的条件到期。分支是否已被删除并不重要,如果它在最近 7 天内有提交,那么即使它被立即删除,它也会在最后一次提交后保持可见 7 天。

所以基本上不用担心,它们最终会消失,我认为如果 7 天太长无法等待,您可以降低 teamcity.activeVcsBranch.age.days 值,但是您将丢失没有 [=17= 的分支] 我想在那段时间里。

project配置中添加参数后突然成功了。在此之前,我一直在为各个构建添加参数,但从未发现有什么不同。也许这只是我对显而易见的事情的误解。

teamcity.activeBuildBranch.age.hours = 0
teamcity.activeVcsBranch.age.days = 1

这在活动分支列表被剔除的情况下有效。由于我还不能破译的原因,它认为仍然有一个被删除的分支是活跃的(历史在其中被重写了几次),但至少所有其他分支现在都处于非活跃状态。