multibranch-bitbucket regex for source branches
With the SCM API Plugin, a user can specify a regular expression to filter discovered source branches. This behavior is now also configurable from within the yaml configuration. Change-Id: Iff7e385058134e9f072e8b219ec27ff7b9adf2dd
This commit is contained in:
parent
7a21053463
commit
d1e2f75ec5
|
@ -302,6 +302,9 @@ def bitbucket_scm(xml_parent, data):
|
|||
:arg bool discover-tags: Discovers tags on the repository.
|
||||
(default false)
|
||||
:arg str server-url: The address of the bitbucket server. (optional)
|
||||
:arg str head-filter-regex: A regular expression for filtering
|
||||
discovered source branches. Requires the :jenkins-wiki:`SCM API Plugin
|
||||
<SCM+API+Plugin>`.
|
||||
|
||||
Minimal Example:
|
||||
|
||||
|
@ -336,6 +339,10 @@ def bitbucket_scm(xml_parent, data):
|
|||
if data.get('discover-tags', False):
|
||||
XML.SubElement(traits,
|
||||
'com.cloudbees.jenkins.plugins.bitbucket.TagDiscoveryTrait')
|
||||
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')
|
||||
|
||||
|
||||
def gerrit_scm(xml_parent, data):
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
<serverUrl>https://bitbucket.example.com:8080</serverUrl>
|
||||
<traits>
|
||||
<com.cloudbees.jenkins.plugins.bitbucket.TagDiscoveryTrait/>
|
||||
<jenkins.scm.impl.trait.RegexSCMHeadFilterTrait>
|
||||
<regex>master|\d+\.\d+</regex>
|
||||
</jenkins.scm.impl.trait.RegexSCMHeadFilterTrait>
|
||||
</traits>
|
||||
</source>
|
||||
</jenkins.branch.BranchSource>
|
||||
|
|
|
@ -8,3 +8,4 @@ scm:
|
|||
repo: 'test'
|
||||
server-url: https://bitbucket.example.com:8080
|
||||
discover-tags: true
|
||||
head-filter-regex: 'master|\d+\.\d+'
|
||||
|
|
Loading…
Reference in New Issue