Fix GitHub pull request builder plugin support

Change-Id: Iac1d06be91b641f7fccfe2255247443363ba2e80
This commit is contained in:
Kei YAMAZAKI 2013-12-08 00:24:45 +09:00
parent 04be0f43ad
commit 4d0b78d3bf
3 changed files with 59 additions and 14 deletions
jenkins_jobs/modules
tests/triggers/fixtures

@ -348,24 +348,22 @@ def github_pull_request(parser, xml_parent, data):
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)
:arg string cron: cron syntax of when to run (optional)
:arg string trigger-phrase: when filled, commenting this phrase
in the pull request will trigger a build (optional)
:arg bool only-trigger-phrase: only commenting the trigger phrase
in the pull request will trigger a build (default false)
:arg bool github-hooks: use github hook (default false)
:arg bool permit-all: build every pull request automatically
without asking (default false)
:arg bool auto-close-on-fail: close failed pull request automatically
(default false)
Example::
Example:
triggers:
- github-pull-request:
admin-list:
- user1
- user2
cron: * * * * *
white-list:
- user3
- user4
org-list:
- org1
- org2
.. literalinclude:: ../../tests/triggers/fixtures/github-pull-request.yaml
"""
ghprb = XML.SubElement(xml_parent, 'org.jenkinsci.plugins.ghprb.'
'GhprbTrigger')
@ -377,6 +375,16 @@ def github_pull_request(parser, xml_parent, data):
org_string = "\n".join(data.get('org-list', []))
XML.SubElement(ghprb, 'orgslist').text = org_string
XML.SubElement(ghprb, 'cron').text = data.get('cron', '')
XML.SubElement(ghprb, 'triggerPhrase').text = \
data.get('trigger-phrase', '')
XML.SubElement(ghprb, 'onlyTriggerPhrase').text = str(
data.get('only-trigger-phrase', False)).lower()
XML.SubElement(ghprb, 'useGitHubHooks').text = str(
data.get('github-hooks', False)).lower()
XML.SubElement(ghprb, 'permitAll').text = str(
data.get('permit-all', False)).lower()
XML.SubElement(ghprb, 'autoCloseFailedPullRequests').text = str(
data.get('auto-close-on-fail', False)).lower()
def build_result(parser, xml_parent, data):

@ -0,0 +1,20 @@
<?xml version="1.0" ?>
<project>
<triggers class="vector">
<org.jenkinsci.plugins.ghprb.GhprbTrigger>
<spec>* * * * *</spec>
<adminlist>user1
user2</adminlist>
<whitelist>user3
user4</whitelist>
<orgslist>org1
org2</orgslist>
<cron>* * * * *</cron>
<triggerPhrase>retest this please</triggerPhrase>
<onlyTriggerPhrase>true</onlyTriggerPhrase>
<useGitHubHooks>true</useGitHubHooks>
<permitAll>false</permitAll>
<autoCloseFailedPullRequests>false</autoCloseFailedPullRequests>
</org.jenkinsci.plugins.ghprb.GhprbTrigger>
</triggers>
</project>

@ -0,0 +1,17 @@
triggers:
- github-pull-request:
admin-list:
- user1
- user2
white-list:
- user3
- user4
org-list:
- org1
- org2
cron: '* * * * *'
trigger-phrase: 'retest this please'
only-trigger-phrase: true
github-hooks: true
permit-all: false
auto-close-on-fail: false