我如何配置 Jenkins 来构建除我排除的少数分支之外的所有分支?
How do I configure Jenkins to build all branches except a few which I exclude?
我们在 git 中有一些代码,我开始设置 Jenkins 来抓取我们的分支并尝试编译。似乎自上次建造以来,一些树枝可能已经开始腐烂,因为它们无法完成建造。
我想构建找到的所有分支,排除的分支列表除外。这在詹金斯可能吗?这会让我把事情搞定 运行,然后在我尝试修复它们时回来启用更多分支。
到目前为止我尝试了什么
带前瞻性的正则表达式
查看 'Git > Branches to build' 选项,我希望可以用 : 替换默认的“**”通配符。对 http://rubular.com/ 进行一些挖掘和双重检查表明以下内容可能会满足我的要求。
:^(?!origin/exclude\-this\-branch\.v1|origin/exclude\-this\-branch\-too.v2)(\S+)
现在这里有一个关于后台正则表达式引擎 运行 的假设。我希望它能理解前瞻,但如果它不理解,那就解释了为什么这个方法失败了。它似乎构建了所有分支,包括我试图排除的分支。也许我只需要再找一些调试?
在这里寻找类似的问题
我发现 Jenkins/Hudson Build All Branches With Prioritization which seemed to contain a possible solution in that some added an inverse option to branch matching https://github.com/jenkinsci/git-plugin/pull/45 听起来像我需要的。遗憾的是,这似乎不在我拥有的 Jenkins 版本中,这很奇怪,因为 2011 年是很久以前的事了。
我正在使用的系统
Ubuntu LTS 14.04。詹金斯版本。 1.611。用于制作 C/C++ 代码的 GNU 工具链。
如何使用
^(?!.*master).*$
作为分支说明符。此正则表达式表示所有分支均不匹配 master。
细分:
^(?!.*master).*$
^ ---> beginning of string
(?! ) ---> negative lookahead find all that doesnt match
.* ---> zero or more of 'any' character
master ---> should not match master
.*$ ---> will match anything to the end of string
相关:
我需要使用 Jenkins 工具 "filter branch by regex",并且我发现该正则表达式的风格仅适用于反向引用。
所以,在 Jesper response and this issue 之后,我又做了两个例子:
^(?:.*release\/\d+.\d+.\d+(?!.))$
// check all branches like "release/0.0.0" or "origin/release/1.2.3"
^(?:.*release\/\d+.\d+.\d+_any)$
// check all branches like "release/0.0.0_any" or "origin/release/1.2.3_any"
我希望这对某人有所帮助
编辑 - New example
^(?:origin\/develop|origin\/master|origin\/release\/\d+\.\d+\.\d+(?!.)|origin\/release\/\d+\.\d+\.\d+(?:_uat|_preprod))$
或
^(?:.*develop|.*master|.*release/\d+\.\d+\.\d+(?!.))$
我们在 git 中有一些代码,我开始设置 Jenkins 来抓取我们的分支并尝试编译。似乎自上次建造以来,一些树枝可能已经开始腐烂,因为它们无法完成建造。
我想构建找到的所有分支,排除的分支列表除外。这在詹金斯可能吗?这会让我把事情搞定 运行,然后在我尝试修复它们时回来启用更多分支。
到目前为止我尝试了什么
带前瞻性的正则表达式
查看 'Git > Branches to build' 选项,我希望可以用 : 替换默认的“**”通配符。对 http://rubular.com/ 进行一些挖掘和双重检查表明以下内容可能会满足我的要求。
:^(?!origin/exclude\-this\-branch\.v1|origin/exclude\-this\-branch\-too.v2)(\S+)
现在这里有一个关于后台正则表达式引擎 运行 的假设。我希望它能理解前瞻,但如果它不理解,那就解释了为什么这个方法失败了。它似乎构建了所有分支,包括我试图排除的分支。也许我只需要再找一些调试?
在这里寻找类似的问题
我发现 Jenkins/Hudson Build All Branches With Prioritization which seemed to contain a possible solution in that some added an inverse option to branch matching https://github.com/jenkinsci/git-plugin/pull/45 听起来像我需要的。遗憾的是,这似乎不在我拥有的 Jenkins 版本中,这很奇怪,因为 2011 年是很久以前的事了。
我正在使用的系统
Ubuntu LTS 14.04。詹金斯版本。 1.611。用于制作 C/C++ 代码的 GNU 工具链。
如何使用
^(?!.*master).*$
作为分支说明符。此正则表达式表示所有分支均不匹配 master。
细分:
^(?!.*master).*$
^ ---> beginning of string
(?! ) ---> negative lookahead find all that doesnt match
.* ---> zero or more of 'any' character
master ---> should not match master
.*$ ---> will match anything to the end of string
相关:
我需要使用 Jenkins 工具 "filter branch by regex",并且我发现该正则表达式的风格仅适用于反向引用。 所以,在 Jesper response and this issue 之后,我又做了两个例子:
^(?:.*release\/\d+.\d+.\d+(?!.))$
// check all branches like "release/0.0.0" or "origin/release/1.2.3"
^(?:.*release\/\d+.\d+.\d+_any)$
// check all branches like "release/0.0.0_any" or "origin/release/1.2.3_any"
我希望这对某人有所帮助
编辑 - New example
^(?:origin\/develop|origin\/master|origin\/release\/\d+\.\d+\.\d+(?!.)|origin\/release\/\d+\.\d+\.\d+(?:_uat|_preprod))$
或
^(?:.*develop|.*master|.*release/\d+\.\d+\.\d+(?!.))$