Enable whitelisting branches with pull request builder
Adds support for specifiying the specific branches that will be monitored by the github pull request builder. Details on this functionality can be found at https://wiki.jenkins-ci.org/display/JENKINS/ GitHub+pull+request+builder+plugin Change-Id: If98ce3ca037d3ce33506cf1ffea372e7c18eefda
This commit is contained in:
@@ -656,6 +656,11 @@ def github_pull_request(parser, xml_parent, data):
|
||||
without asking (default false)
|
||||
:arg bool auto-close-on-fail: close failed pull request automatically
|
||||
(default false)
|
||||
:arg list white-list-target-branches: Adding branches to this whitelist
|
||||
allows you to selectively test pull requests destined for these
|
||||
branches only. Supports regular expressions (e.g. 'master',
|
||||
'feature-.*'). (optional)
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
@@ -682,6 +687,14 @@ def github_pull_request(parser, xml_parent, data):
|
||||
XML.SubElement(ghprb, 'autoCloseFailedPullRequests').text = str(
|
||||
data.get('auto-close-on-fail', False)).lower()
|
||||
|
||||
white_list_target_branches = data.get('white-list-target-branches', [])
|
||||
if white_list_target_branches:
|
||||
ghprb_wltb = XML.SubElement(ghprb, 'whiteListTargetBranches')
|
||||
for branch in white_list_target_branches:
|
||||
be = XML.SubElement(ghprb_wltb, 'org.jenkinsci.plugins.'
|
||||
'ghprb.GhprbBranch')
|
||||
XML.SubElement(be, 'branch').text = str(branch)
|
||||
|
||||
|
||||
def gitlab_merge_request(parser, xml_parent, data):
|
||||
"""yaml: gitlab-merge-request
|
||||
|
||||
@@ -15,6 +15,14 @@
|
||||
<useGitHubHooks>true</useGitHubHooks>
|
||||
<permitAll>false</permitAll>
|
||||
<autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
|
||||
<whiteListTargetBranches>
|
||||
<org.jenkinsci.plugins.ghprb.GhprbBranch>
|
||||
<branch>master</branch>
|
||||
</org.jenkinsci.plugins.ghprb.GhprbBranch>
|
||||
<org.jenkinsci.plugins.ghprb.GhprbBranch>
|
||||
<branch>testing</branch>
|
||||
</org.jenkinsci.plugins.ghprb.GhprbBranch>
|
||||
</whiteListTargetBranches>
|
||||
</org.jenkinsci.plugins.ghprb.GhprbTrigger>
|
||||
</triggers>
|
||||
</project>
|
||||
|
||||
@@ -15,3 +15,6 @@ triggers:
|
||||
github-hooks: true
|
||||
permit-all: false
|
||||
auto-close-on-fail: false
|
||||
white-list-target-branches:
|
||||
- master
|
||||
- testing
|
||||
|
||||
Reference in New Issue
Block a user