Merge "ghprb: blacklist-target-branches support"

This commit is contained in:
Zuul 2018-07-17 17:03:46 +00:00 committed by Gerrit Code Review
commit 2801467eb9
3 changed files with 23 additions and 0 deletions

View File

@ -965,6 +965,10 @@ def github_pull_request(registry, xml_parent, data):
allows you to selectively test pull requests destined for these allows you to selectively test pull requests destined for these
branches only. Supports regular expressions (e.g. 'master', branches only. Supports regular expressions (e.g. 'master',
'feature-.*'). (optional) 'feature-.*'). (optional)
:arg list black-list-target-branches: Adding branches to this blacklist
allows you to selectively prevent pull requests builds destined for
these branches. Supports regular expressions (e.g. 'master',
'feature-.*'). (optional)
:arg string auth-id: the auth id to use (optional) :arg string auth-id: the auth id to use (optional)
:arg string build-desc-template: the template for build descriptions in :arg string build-desc-template: the template for build descriptions in
jenkins (optional) jenkins (optional)
@ -1058,6 +1062,14 @@ def github_pull_request(registry, xml_parent, data):
'ghprb.GhprbBranch') 'ghprb.GhprbBranch')
XML.SubElement(be, 'branch').text = str(branch) XML.SubElement(be, 'branch').text = str(branch)
black_list_target_branches = data.get('black-list-target-branches', [])
if black_list_target_branches:
ghprb_bltb = XML.SubElement(ghprb, 'blackListTargetBranches')
for branch in black_list_target_branches:
be = XML.SubElement(ghprb_bltb, 'org.jenkinsci.plugins.'
'ghprb.GhprbBranch')
XML.SubElement(be, 'branch').text = str(branch)
auth_id = data.get('auth-id', '') auth_id = data.get('auth-id', '')
if auth_id: if auth_id:
XML.SubElement(ghprb, 'gitHubAuthId').text = str(auth_id) XML.SubElement(ghprb, 'gitHubAuthId').text = str(auth_id)

View File

@ -34,6 +34,14 @@ region</includedRegions>
<branch>testing</branch> <branch>testing</branch>
</org.jenkinsci.plugins.ghprb.GhprbBranch> </org.jenkinsci.plugins.ghprb.GhprbBranch>
</whiteListTargetBranches> </whiteListTargetBranches>
<blackListTargetBranches>
<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>
</blackListTargetBranches>
<gitHubAuthId>123-456-789</gitHubAuthId> <gitHubAuthId>123-456-789</gitHubAuthId>
<extensions> <extensions>
<org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus> <org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus>

View File

@ -27,6 +27,9 @@ triggers:
white-list-target-branches: white-list-target-branches:
- master - master
- testing - testing
black-list-target-branches:
- master
- testing
auth-id: '123-456-789' auth-id: '123-456-789'
status-context: "status context" status-context: "status context"
triggered-status: "triggered status message" triggered-status: "triggered status message"