目前,Jenkins 使用下面显示的设置构建 master
和所有 *-preview
分支。使用分支构建,Jenkins 是否可以排除单个 *-preview
分支,例如 exclude-this-branch-在构建所有剩余的
?*-preview
分支时预览
最佳答案
您可以通过在前面指定分号来使用正则表达式
:^(?!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
关于git - 要构建的 Jenkins 分支 - 排除单个分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45243512/