Merge "Add head-filter-regex to gerrit_scm"

This commit is contained in:
Zuul 2023-01-23 10:13:33 +00:00 committed by Gerrit Code Review
commit d9f6b1ffbb
3 changed files with 11 additions and 0 deletions

View File

@ -659,6 +659,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
@ -798,6 +801,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:

View File

@ -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>

View File

@ -46,6 +46,7 @@ scm:
- exact-name: {}
- regex-name: {}
- wildcards-name: {}
head-filter-regex: "(.*/master|.*/release/.*)"
clean:
after: true
before: true