Add trigger for RabbitMQ trigger module
Change-Id: I4065fb95c0a54507eb079b9c92e2343237b87027
This commit is contained in:
parent
a7a14b5a65
commit
d07ec2b238
@ -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
|
||||
|
||||
|
9
tests/triggers/fixtures/rabbitmq.xml
Normal file
9
tests/triggers/fixtures/rabbitmq.xml
Normal 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>
|
3
tests/triggers/fixtures/rabbitmq.yaml
Normal file
3
tests/triggers/fixtures/rabbitmq.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
triggers:
|
||||
- rabbitmq:
|
||||
token: 'build_trigger_token'
|
Loading…
Reference in New Issue
Block a user