Add support for filtering by name in git source
Change-Id: I31bcf257e3f508462b870d0559dd7fed580232bc
This commit is contained in:
parent
3b777009f3
commit
b263d78f55
@ -489,6 +489,9 @@ def git_scm(xml_parent, data):
|
||||
(default false)
|
||||
:arg bool ignore-on-push-notifications: If a job should not trigger upon
|
||||
push notifications. (default false)
|
||||
:arg str head-filter-regex: A regular expression for filtering
|
||||
discovered source branches. Requires the :jenkins-wiki:`SCM API Plugin
|
||||
<SCM+API+Plugin>`.
|
||||
: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
|
||||
@ -532,6 +535,11 @@ def git_scm(xml_parent, data):
|
||||
XML.SubElement(
|
||||
traits, ''.join([traits_path, '.IgnoreOnPushNotificationTrait']))
|
||||
|
||||
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')
|
||||
|
||||
if data.get('build-strategies', None):
|
||||
build_strategies(xml_parent, data)
|
||||
|
||||
|
@ -38,6 +38,9 @@
|
||||
<traits>
|
||||
<jenkins.plugins.git.traits.TagDiscoveryTrait/>
|
||||
<jenkins.plugins.git.traits.IgnoreOnPushNotificationTrait/>
|
||||
<jenkins.scm.impl.trait.RegexSCMHeadFilterTrait>
|
||||
<regex>master|\d+\.\d+</regex>
|
||||
</jenkins.scm.impl.trait.RegexSCMHeadFilterTrait>
|
||||
</traits>
|
||||
</source>
|
||||
<buildStrategies>
|
||||
|
@ -8,6 +8,7 @@ scm:
|
||||
discover-branches: false
|
||||
ignore-on-push-notifications: true
|
||||
discover-tags: true
|
||||
head-filter-regex: 'master|\d+\.\d+'
|
||||
build-strategies:
|
||||
- tags:
|
||||
ignore-tags-newer-than: 1
|
||||
|
Loading…
Reference in New Issue
Block a user