为TeamCity Build Configuration选择Git分支

时间:2015-12-30 21:29:28

标签: github build continuous-integration teamcity teamcity-9.0

我想在我的CI框中通过teamcity完成以下操作。

Master branch commit : Build and Release
Beta branch commit: Build and Release to Crashlytics
All other commits to any other branch: Build

(旁注,因为我们的大多数开发分支可能包含也可能不包含前缀,因此很难使用"功能 - *"分支命名)

关注此问题Select Git branch for TeamCity Build

我在项目设置中创建了配置参数

enter image description here

然后

我的VCS根设置

enter image description here

然后我创建了一个构建模板

enter image description here

当我创建构建时,我确保分支名称正确

enter image description here

我也试过编辑触发器

enter image description here

当我将提交推送到Beta分支

时,这怎么回事?

我认为因为ref/heads/*默认构建正在运行所有分支

和Beta和Master显示"待定"

enter image description here

我该如何纠正?

2 个答案:

答案 0 :(得分:1)

我通过与其他开发人员交谈并确保所有开发分支都使用前缀来解决问题,在这种情况下XAAI-

然后在我的VCS根设置

enter image description here

对于每个构建配置中的触发器,我确保仅在签入该分支时触发它。

例如QA(Betabuild)

enter image description here

这是棘手的部分,对于开发分支我必须给出一个空参数,我不知道为什么(也许是因为某些东西需要检查默认分支,它应该是ref / heads / )但不管它是什么原因。*

enter image description here

然后终于整个事情看起来像这样

enter image description here

这个悬而未决的事情仍然令人讨厌,但我认为至少它正如我现在设想的那样工作。

答案 1 :(得分:0)

如果您希望构建仅在推送默认分支时自动触发,则可以向触发器添加分支过滤器,如+:<default>

这取决于您已正确设置每个构建配置中的%BranchName%参数的假设。 IE,对于您的默认构建,使%BranchName%参数= master。

作为旁注,您仍会看到每个分支的所有挂起更改,但只有在添加分支过滤器时才推送到默认构建时,触发器才会运行。如果要删除每个分支的挂起更改,则需要为每个配置设置vcs root specfic以过滤掉所有分支。

相关问题