Add head-filter-regex to gerrit_scm
This makes it possible to filter branches with regular expressions also when using the gerrit_scm. Change-Id: Ie43674cccf942420d42e1ee4fd194db30b09d19f
This commit is contained in:
parent
2bff1024fa
commit
e064158d05
@ -653,6 +653,9 @@ def gerrit_scm(xml_parent, data):
|
||||
(default '*')
|
||||
:arg str excludes: Comma-separated list of branches to be excluded.
|
||||
(default '')
|
||||
:arg str head-filter-regex: A regular expression for filtering
|
||||
discovered source branches. Requires the :jenkins-plugins:`SCM API
|
||||
Plugin <scm-api>`.
|
||||
:arg list build-strategies: Provides control over whether to build a branch
|
||||
(or branch like things such as change requests and tags) whenever it is
|
||||
discovered initially or a change from the previous revision has been
|
||||
@ -786,6 +789,10 @@ def gerrit_scm(xml_parent, data):
|
||||
if data.get("build-strategies", None):
|
||||
build_strategies(xml_parent, data)
|
||||
|
||||
if data.get("head-filter-regex", None):
|
||||
rshf = XML.SubElement(traits, "jenkins.scm.impl.trait.RegexSCMHeadFilterTrait")
|
||||
XML.SubElement(rshf, "regex").text = data.get("head-filter-regex")
|
||||
|
||||
# FilterChecks Trait
|
||||
checks = data.get("filter-checks", None)
|
||||
if checks:
|
||||
|
@ -47,6 +47,9 @@
|
||||
</jenkins.plugins.git.traits.RefSpecsSCMSourceTrait_-RefSpecTemplate>
|
||||
</templates>
|
||||
</jenkins.plugins.git.traits.RefSpecsSCMSourceTrait>
|
||||
<jenkins.scm.impl.trait.RegexSCMHeadFilterTrait>
|
||||
<regex>(.*/master|.*/release/.*)</regex>
|
||||
</jenkins.scm.impl.trait.RegexSCMHeadFilterTrait>
|
||||
<jenkins.plugins.gerrit.traits.FilterChecksTrait>
|
||||
<queryOperator>SCHEME</queryOperator>
|
||||
<queryString>jenkins</queryString>
|
||||
|
@ -46,6 +46,7 @@ scm:
|
||||
- exact-name: {}
|
||||
- regex-name: {}
|
||||
- wildcards-name: {}
|
||||
head-filter-regex: "(.*/master|.*/release/.*)"
|
||||
clean:
|
||||
after: true
|
||||
before: true
|
||||
|
Loading…
x
Reference in New Issue
Block a user