Adding GitHub Pull Request Builder Plugin

Adding the ability to use the GitHub Pull Request Builder plugin.
This plugin requires modifications on the Configure System page
of Jenkins to work properly.  If using GitHub Enterprise you must
set the token on this page, password does not work.  This change
affects the modules/triggers.py and setup.py file, adding a new
section for this plugin.  When using this plugin in the GUI the
textboxes for admin list and crontab will default to the values
stored on the main Configure System Jenkins page, I don't think
JJB can even attempt this default so I just defaulted to nothing.

Change-Id: Ib453cee269038e04f01a446378922b36307c18ce
Reviewed-on: https://review.openstack.org/24929
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: James E. Blair <corvus@inaugust.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
This commit is contained in:
Will Soula 2013-03-20 15:05:22 -05:00 committed by Jenkins
parent 3e6dac4602
commit 1c0b7308c8
2 changed files with 41 additions and 0 deletions

View File

@ -269,6 +269,45 @@ def github(parser, xml_parent, data):
XML.SubElement(ghtrig, 'spec').text = ''
def github_pull_request(parser, xml_parent, data):
"""yaml: github-pull-request
Build pull requests in github and report results
Requires the Jenkins `GitHub Pull Request Builder Plugin.
<https://wiki.jenkins-ci.org/display/JENKINS/
GitHub+pull+request+builder+plugin>`_
:arg list admin-list: the users with admin rights (optional)
:arg string cron: cron syntax of when to run (optional)
:arg list white-list: users whose pull requests build (optional)
:arg list org-list: orgs whose users should be white listed (optional)
Example::
triggers:
- github-pull-request:
admin-list:
- user1
- user2
cron: * * * * *
white-list:
- user3
- user4
org-list:
- org1
- org2
"""
ghprb = XML.SubElement(xml_parent, 'org.jenkinsci.plugins.ghprb.'
'GhprbTrigger')
XML.SubElement(ghprb, 'spec').text = data.get('cron', '')
admin_string = "\n".join(data.get('admin-list', []))
XML.SubElement(ghprb, 'adminlist').text = admin_string
white_string = "\n".join(data.get('white-list', []))
XML.SubElement(ghprb, 'whitelist').text = white_string
org_string = "\n".join(data.get('org-list', []))
XML.SubElement(ghprb, 'orgslist').text = org_string
XML.SubElement(ghprb, 'cron').text = data.get('cron', '')
class Triggers(jenkins_jobs.modules.base.Base):
sequence = 50

View File

@ -126,6 +126,8 @@ setuptools.setup(
'pollscm=jenkins_jobs.modules.triggers:pollscm',
'timed=jenkins_jobs.modules.triggers:timed',
'github=jenkins_jobs.modules.triggers:github',
'github-pull-request=jenkins_jobs.modules.triggers:'
'github_pull_request',
],
'jenkins_jobs.wrappers': [
'timeout=jenkins_jobs.modules.wrappers:timeout',