Add support for the RunDeck plugin
Change-Id: Ic324af03e3c4a110f34041c71ce0cecb7b474560
This commit is contained in:
parent
c61fe7d1e2
commit
7ee3cc1ceb
@ -4121,6 +4121,56 @@ def downstream_ext(parser, xml_parent, data):
|
||||
data.get('only-on-local-scm-change', False)).lower()
|
||||
|
||||
|
||||
def rundeck(parser, xml_parent, data):
|
||||
"""yaml: rundeck
|
||||
Trigger a rundeck job when the build is complete.
|
||||
|
||||
Requires the Jenkins :jenkins-wiki:`RunDeck
|
||||
Plugin <RunDeck+Plugin>`.
|
||||
|
||||
:arg str job-id: The RunDeck job identifier. (required)
|
||||
This could be:
|
||||
* ID example : "42"
|
||||
* UUID example : "2027ce89-7924-4ecf-a963-30090ada834f"
|
||||
* reference, in the format : "project:group/job"
|
||||
:arg str options: List of options for the Rundeck job, in Java-Properties
|
||||
format: key=value (default "")
|
||||
:arg str node-filters: List of filters to optionally filter the nodes
|
||||
included by the job. (default "")
|
||||
:arg str tag: Used for on-demand job scheduling on rundeck: if a tag is
|
||||
specified, the job will only execute if the given tag is present in the
|
||||
SCM changelog. (default "")
|
||||
:arg bool wait-for-rundeck: If true Jenkins will wait for the job to
|
||||
complete, if false the job will be started and Jenkins will move on.
|
||||
(default false)
|
||||
:arg bool fail-the-build: If true a RunDeck job failure will cause the
|
||||
Jenkins build to fail. (default false)
|
||||
|
||||
Example:
|
||||
|
||||
.. literalinclude:: /../../tests/publishers/fixtures/rundeck001.yaml
|
||||
:language: yaml
|
||||
|
||||
Full example:
|
||||
|
||||
.. literalinclude:: /../../tests/publishers/fixtures/rundeck002.yaml
|
||||
:language: yaml
|
||||
"""
|
||||
|
||||
p = XML.SubElement(
|
||||
xml_parent,
|
||||
'org.jenkinsci.plugins.rundeck.RundeckNotifier')
|
||||
|
||||
XML.SubElement(p, 'jobId').text = str(data.get('job-id'))
|
||||
XML.SubElement(p, 'options').text = str(data.get('options', ''))
|
||||
XML.SubElement(p, 'nodeFilters').text = str(data.get('node-filters', ''))
|
||||
XML.SubElement(p, 'tag').text = str(data.get('tag', ''))
|
||||
XML.SubElement(p, 'shouldWaitForRundeckJob').text = str(
|
||||
data.get('wait-for-rundeck', False)).lower()
|
||||
XML.SubElement(p, 'shouldFailTheBuild').text = str(
|
||||
data.get('fail-the-build', False)).lower()
|
||||
|
||||
|
||||
def create_publishers(parser, action):
|
||||
dummy_parent = XML.Element("dummy")
|
||||
parser.registry.dispatch('publisher', parser, dummy_parent, action)
|
||||
|
@ -192,6 +192,7 @@ jenkins_jobs.publishers =
|
||||
rich-text-publisher=jenkins_jobs.modules.publishers:rich_text_publisher
|
||||
robot=jenkins_jobs.modules.publishers:robot
|
||||
ruby-metrics=jenkins_jobs.modules.publishers:ruby_metrics
|
||||
rundeck=jenkins_jobs.modules.publishers:rundeck
|
||||
s3=jenkins_jobs.modules.publishers:s3
|
||||
scan-build=jenkins_jobs.modules.publishers:scan_build
|
||||
scoverage=jenkins_jobs.modules.publishers:scoverage
|
||||
|
13
tests/publishers/fixtures/rundeck001.xml
Normal file
13
tests/publishers/fixtures/rundeck001.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<org.jenkinsci.plugins.rundeck.RundeckNotifier>
|
||||
<jobId>testproject:group/jobname</jobId>
|
||||
<options/>
|
||||
<nodeFilters/>
|
||||
<tag/>
|
||||
<shouldWaitForRundeckJob>false</shouldWaitForRundeckJob>
|
||||
<shouldFailTheBuild>false</shouldFailTheBuild>
|
||||
</org.jenkinsci.plugins.rundeck.RundeckNotifier>
|
||||
</publishers>
|
||||
</project>
|
3
tests/publishers/fixtures/rundeck001.yaml
Normal file
3
tests/publishers/fixtures/rundeck001.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
publishers:
|
||||
- rundeck:
|
||||
job-id: testproject:group/jobname
|
15
tests/publishers/fixtures/rundeck002.xml
Normal file
15
tests/publishers/fixtures/rundeck002.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<org.jenkinsci.plugins.rundeck.RundeckNotifier>
|
||||
<jobId>testproject:group/jobname</jobId>
|
||||
<options>STUFF_FOR_THE_JOB=stuff
|
||||
ANOTHER_VAR=more_stuff
|
||||
</options>
|
||||
<nodeFilters>dev</nodeFilters>
|
||||
<tag>master</tag>
|
||||
<shouldWaitForRundeckJob>true</shouldWaitForRundeckJob>
|
||||
<shouldFailTheBuild>true</shouldFailTheBuild>
|
||||
</org.jenkinsci.plugins.rundeck.RundeckNotifier>
|
||||
</publishers>
|
||||
</project>
|
10
tests/publishers/fixtures/rundeck002.yaml
Normal file
10
tests/publishers/fixtures/rundeck002.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
publishers:
|
||||
- rundeck:
|
||||
job-id: testproject:group/jobname
|
||||
options: |
|
||||
STUFF_FOR_THE_JOB=stuff
|
||||
ANOTHER_VAR=more_stuff
|
||||
node-filters: dev
|
||||
tag: master
|
||||
wait-for-rundeck: true
|
||||
fail-the-build: true
|
Loading…
Reference in New Issue
Block a user