Add trigger for RabbitMQ trigger module

Change-Id: I4065fb95c0a54507eb079b9c92e2343237b87027
This commit is contained in:
Tim Birkett 2016-01-29 00:35:04 +00:00 committed by Darragh Bailey
parent a7a14b5a65
commit d07ec2b238
3 changed files with 40 additions and 0 deletions

View File

@ -1559,6 +1559,34 @@ def groovy_script(parser, xml_parent, data):
XML.SubElement(gst, 'spec').text = str(data.get('cron', ''))
def rabbitmq(parser, xml_parent, data):
"""yaml: rabbitmq
This plugin triggers build using remote build message in RabbitMQ queue.
Requires the Jenkins :jenkins-wiki:`RabbitMQ Build Trigger Plugin
<RabbitMQ+Build+Trigger+Plugin>`.
:arg str token: the build token expected in the message queue (required)
Example:
.. literalinclude:: /../../tests/triggers/fixtures/rabbitmq.yaml
:language: yaml
"""
rabbitmq = XML.SubElement(
xml_parent,
'org.jenkinsci.plugins.rabbitmqbuildtrigger.'
'RemoteBuildTrigger')
XML.SubElement(rabbitmq, 'spec').text = ''
try:
XML.SubElement(rabbitmq, 'remoteBuildToken').text = str(
data.get('token'))
except KeyError as e:
raise MissingAttributeError(e.arg[0])
class Triggers(jenkins_jobs.modules.base.Base):
sequence = 50

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<triggers class="vector">
<org.jenkinsci.plugins.rabbitmqbuildtrigger.RemoteBuildTrigger>
<spec/>
<remoteBuildToken>build_trigger_token</remoteBuildToken>
</org.jenkinsci.plugins.rabbitmqbuildtrigger.RemoteBuildTrigger>
</triggers>
</project>

View File

@ -0,0 +1,3 @@
triggers:
- rabbitmq:
token: 'build_trigger_token'