Jenkins分支建设 - 排除单个分支

时间:2017-07-21 17:30:47

标签: git jenkins

目前,使用下面显示的设置,Jenkins构建master和所有*-preview分支。使用 分支构建 ,Jenkins可以在构建所有剩余的*-preview时排除exclude-this-branch-preview分支,例如*-preview分支?

enter image description here

2 个答案:

答案 0 :(得分:3)

您可以通过在

之前指定分号来使用正则表达式
:^(?!exclude-this-branch-preview).*-preview$

来自帮助:

:<regular expression>
The syntax is of the form: :regexp. Regular expression syntax in branches to 
build will only build those branches whose names match the regular expression.
Examples:
:^(?!(origin/prefix)).*
    matches: origin or origin/master or origin/feature
    does not match: origin/prefix or origin/prefix_123 or origin/prefix-abc
:origin/release-\d{8}
    matches: origin/release-20150101
    does not match: origin/release-2015010 or origin/release-201501011 or 
    origin/release-20150101-something
:^(?!origin/master$|origin/develop$).*
    matches: origin/branch1 or origin/branch-2 or origin/master123 or 
    origin/develop-123
    does not match: origin/master or origin/develop

答案 1 :(得分:2)

:^(?!(<the branch name to be excluded with out angular braces>)).*

将它放在分支中以构建并尝试SCM轮询。它是一个正则表达式,自我解释。