Merge "Adding support for Beaker Builder Plugin"

This commit is contained in:
Jenkins 2015-06-11 12:49:58 +00:00 committed by Gerrit Code Review
commit 413c150815
6 changed files with 79 additions and 0 deletions

View File

@ -1949,3 +1949,42 @@ def sonatype_clm(parser, xml_parent, data):
data.get('module-excludes', '')).lower()
XML.SubElement(path_config, 'scanProperties').text = str(
data.get('advanced-options', '')).lower()
def beaker(parser, xml_parent, data):
"""yaml: beaker
Execute a beaker build step. Requires the Jenkins :jenkins-wiki:`Beaker
Builder Plugin <Beaker+Builder+Plugin>`.
:arg str content: Run job from string
(Alternative: you can choose a path instead)
:arg str path: Run job from file
(Alternative: you can choose a content instead)
:arg bool download-logs: Download Beaker log files (default false)
Example:
.. literalinclude:: ../../tests/builders/fixtures/beaker-path.yaml
:language: yaml
.. literalinclude:: ../../tests/builders/fixtures/beaker-content.yaml
:language: yaml
"""
beaker = XML.SubElement(xml_parent, 'org.jenkinsci.plugins.beakerbuilder.'
'BeakerBuilder')
jobSource = XML.SubElement(beaker, 'jobSource')
if 'content' in data and 'path' in data:
raise JenkinsJobsException("Use just one of 'content' or 'path'")
elif 'content' in data:
jobSourceClass = "org.jenkinsci.plugins.beakerbuilder.StringJobSource"
jobSource.set('class', jobSourceClass)
XML.SubElement(jobSource, 'jobContent').text = data['content']
elif 'path' in data:
jobSourceClass = "org.jenkinsci.plugins.beakerbuilder.FileJobSource"
jobSource.set('class', jobSourceClass)
XML.SubElement(jobSource, 'jobPath').text = data['path']
else:
raise JenkinsJobsException("Use one of 'content' or 'path'")
XML.SubElement(beaker, 'downloadFiles').text = str(data.get(
'download-logs', False)).lower()

View File

@ -47,6 +47,7 @@ jenkins_jobs.builders =
ant=jenkins_jobs.modules.builders:ant
artifact-resolver=jenkins_jobs.modules.builders:artifact_resolver
batch=jenkins_jobs.modules.builders:batch
beaker=jenkins_jobs.modules.builders:beaker
builders-from=jenkins_jobs.modules.builders:builders_from
change-assembly-version=jenkins_jobs.modules.builders:change_assembly_version
cmake=jenkins_jobs.modules.builders:cmake

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<builders>
<org.jenkinsci.plugins.beakerbuilder.BeakerBuilder>
<jobSource class="org.jenkinsci.plugins.beakerbuilder.StringJobSource">
<jobContent>&lt;job group='product-QA'&gt;
&lt;whiteboard&gt;
Apache 2.2 test
&lt;/whiteboard&gt;
&lt;/job&gt;
</jobContent>
</jobSource>
<downloadFiles>false</downloadFiles>
</org.jenkinsci.plugins.beakerbuilder.BeakerBuilder>
</builders>
</project>

View File

@ -0,0 +1,8 @@
builders:
- beaker:
content: |
<job group='product-QA'>
<whiteboard>
Apache 2.2 test
</whiteboard>
</job>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<builders>
<org.jenkinsci.plugins.beakerbuilder.BeakerBuilder>
<jobSource class="org.jenkinsci.plugins.beakerbuilder.FileJobSource">
<jobPath>test.xml</jobPath>
</jobSource>
<downloadFiles>true</downloadFiles>
</org.jenkinsci.plugins.beakerbuilder.BeakerBuilder>
</builders>
</project>

View File

@ -0,0 +1,4 @@
builders:
- beaker:
path: 'test.xml'
download-logs: true