Pat*_*sen 6 git teamcity continuous-integration
We have a dedicated vcs root which we use to check in steps that check branches (which is a subset of the stuff we do for code in master)
I tried to filter the bitbucket pull request branches and the master branch to have it only trigger on "real" branches, but it still keeps building master commits as well, which is a waste of resources.
I tried this spec:
-:<default>
-:refs/pull-requests/*
+:*
Run Code Online (Sandbox Code Playgroud)
According to my understanding of the spec syntax this should work, but teamcity disagrees.
小智 9
有 3 个地方可以定义分支。前 2 个(默认分支和分支规范)位于您的 VCS 根目录中,使用 Git 规范格式 ( ),并定义要监视更改的refs/heads/master
引用[1]。
Team City 需要一个默认分支来比较更改。这通常是master
除非您有非标准配置。在分支规范中,您需要定义任何其他引用来监视更改。对分支规范中定义的引用的任何更改都会挂接到 TeamCity 中进行处理。
适用于您的场景的 VCS 根设置:
/refs/heads/master
+:*
奇迹真正发生在版本控制设置中。在这些设置中,只有定义的分支可用于构建。本节使用逻辑名称来定义要包含哪些分支。您可能需要单击“显示高级设置”才能查看分支过滤器 [2]。
您可以使用“分支过滤器”右侧的向导来测试一切是否正常工作。单击小棒图标,您应该会看到 VCS Root 正在监视的所有分支。它应该包括 git 存储库中当前的任何其他分支。如果您觉得更容易,您可以使用向导来构建过滤器。
对于您的场景,您应该监视所有内容 ( +:*
),排除主分支 ( -:<default>
) 以及您希望忽略的任何其他分支 ( -:pull-requests/*
)。它应该看起来像:
+:*
-:<default>
-:pull-requests/*
Run Code Online (Sandbox Code Playgroud)
这意味着 master 或以拉取请求开头的任何分支中发生的任何更改都将被忽略。
您可以使用构建触发器并指定哪些特定分支触发构建,更精细地控制基于分支发生的情况。[3]
注意:有一些关于分支过滤和规范的规则可能会令人感兴趣。[4]
2:https ://www.jetbrains.com/help/teamcity/2019.2/branch-filter.html
3:https://www.jetbrains.com/help/teamcity/2019.2/configuring-build-triggers.html
归档时间: |
|
查看次数: |
5476 次 |
最近记录: |