Added github-pull-request-merge publisher
Change-Id: I00dc6d90640aa1771fe3387f30f40e0355290379 Signed-off-by: David Caro <dcaroest@redhat.com>
This commit is contained in:
parent
e3c5203bc1
commit
066804db17
@ -5793,6 +5793,52 @@ def openshift_deploy_canceller(parser, xml_parent, data):
|
||||
convert_mapping_to_xml(osb, data, mapping)
|
||||
|
||||
|
||||
def github_pull_request_merge(parser, xml_parent, data):
|
||||
"""yaml: github-pull-request-merge
|
||||
This action merges the pull request that triggered the build (see the
|
||||
github pull request trigger)
|
||||
Requires the Jenkins :jenkins-wiki:`GitHub pull request builder plugin
|
||||
<GitHub+pull+request+builder+plugin>
|
||||
|
||||
|
||||
:arg bool only-admins-merge: if `true` only administrators can merge the
|
||||
pull request, (default false)
|
||||
:arg bool disallow-own-code: if `true` will allow merging your own pull
|
||||
requests, in opposite to needing someone else to trigger the merge.
|
||||
(default false)
|
||||
:arg bool merge-comment: Comment to set on the merge commit (optional)
|
||||
:arg bool fail-on-non-merge: fail the job if the merge was unsuccessful
|
||||
(default false)
|
||||
:arg bool delete-on-merge: Delete the branch of the pull request on
|
||||
successful merge (default false)
|
||||
|
||||
Full Example:
|
||||
|
||||
.. literalinclude::
|
||||
../../tests/publishers/fixtures/github-pull-request-merge001.yaml
|
||||
:language: yaml
|
||||
|
||||
Minimal Example:
|
||||
|
||||
.. literalinclude::
|
||||
../../tests/publishers/fixtures/github-pull-request-merge002.yaml
|
||||
:language: yaml
|
||||
"""
|
||||
|
||||
osb = XML.SubElement(xml_parent,
|
||||
'org.jenkinsci.plugins.ghprb.GhprbPullRequestMerge')
|
||||
mapping = [
|
||||
# option, xml name, default value
|
||||
("only-admins-merge", 'onlyAdminsMerge', 'false'),
|
||||
("disallow-own-code", 'disallowOwnCode', 'false'),
|
||||
("merge-comment", 'mergeComment', None),
|
||||
("fail-on-non-merge", 'failOnNonMerge', 'false'),
|
||||
("delete-on-merge", 'deleteOnMerge', 'false'),
|
||||
]
|
||||
|
||||
convert_mapping_to_xml(osb, data, mapping)
|
||||
|
||||
|
||||
class Publishers(jenkins_jobs.modules.base.Base):
|
||||
sequence = 70
|
||||
|
||||
|
12
tests/publishers/fixtures/github-pull-request-merge001.xml
Normal file
12
tests/publishers/fixtures/github-pull-request-merge001.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<org.jenkinsci.plugins.ghprb.GhprbPullRequestMerge>
|
||||
<onlyAdminsMerge>true</onlyAdminsMerge>
|
||||
<disallowOwnCode>true</disallowOwnCode>
|
||||
<mergeComment>my fancy commit message</mergeComment>
|
||||
<failOnNonMerge>true</failOnNonMerge>
|
||||
<deleteOnMerge>true</deleteOnMerge>
|
||||
</org.jenkinsci.plugins.ghprb.GhprbPullRequestMerge>
|
||||
</publishers>
|
||||
</project>
|
@ -0,0 +1,7 @@
|
||||
publishers:
|
||||
- github-pull-request-merge:
|
||||
only-admins-merge: true
|
||||
disallow-own-code: true
|
||||
merge-comment: 'my fancy commit message'
|
||||
fail-on-non-merge: true
|
||||
delete-on-merge: true
|
11
tests/publishers/fixtures/github-pull-request-merge002.xml
Normal file
11
tests/publishers/fixtures/github-pull-request-merge002.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<org.jenkinsci.plugins.ghprb.GhprbPullRequestMerge>
|
||||
<onlyAdminsMerge>false</onlyAdminsMerge>
|
||||
<disallowOwnCode>false</disallowOwnCode>
|
||||
<failOnNonMerge>false</failOnNonMerge>
|
||||
<deleteOnMerge>false</deleteOnMerge>
|
||||
</org.jenkinsci.plugins.ghprb.GhprbPullRequestMerge>
|
||||
</publishers>
|
||||
</project>
|
@ -0,0 +1,2 @@
|
||||
publishers:
|
||||
- github-pull-request-merge
|
Loading…
Reference in New Issue
Block a user