Support for Xvfb plugin

* compatibility checked with versions 1.0.8 and 1.0.16

Change-Id: Icb59daf3bc6a2d69e2eb295cce5e7c03bd3a9f39
This commit is contained in:
Michal Vanco 2015-02-27 10:23:22 +01:00
parent e1cc03e606
commit 380404b571
6 changed files with 112 additions and 0 deletions

View File

@ -1352,6 +1352,67 @@ def job_log_logger(parser, xml_parent, data):
data.get('suppress-empty', True)).lower()
def xvfb(parser, xml_parent, data):
"""yaml: xvfb
Enable xvfb during the build.
Requires the Jenkins :jenkins-wiki:`Xvfb Plugin <Xvfb+Plugin>`.
:arg str installation-name: The name of the Xvfb tool instalation
(default: default)
:arg bool auto-display-name: Uses the -displayfd option of Xvfb by which it
chooses it's own display name
(default: false)
:arg str display-name: Ordinal of the display Xvfb will be running on, if
left empty choosen based on current build executor
number (optional)
:arg str assigned-labels: If you want to start Xvfb only on specific nodes
specify its name or label (optional)
:arg bool parallel-build: When running multiple Jenkins nodes on the same
machine this setting influences the display
number generation (default: false)
:arg int timeout: A timeout of given seconds to wait before returning
control to the job (default: 0)
:arg str screen: Resolution and color depth. (default: 1024x768x24)
:arg str display-name-offset: Offset for display names. (default: 1)
:arg str additional-options: Additional options to be added with the
options above to the Xvfb command line
(optional)
:arg bool debug: If Xvfb output should appear in console log of this job
(default: false)
:arg bool shutdown-with-build: Should the display be kept until the whole
job ends (default: false)
Example:
.. literalinclude:: /../../tests/wrappers/fixtures/xvfb001.yaml
"""
xwrapper = XML.SubElement(xml_parent,
'org.jenkinsci.plugins.xvfb.XvfbBuildWrapper')
XML.SubElement(xwrapper, 'installationName').text = str(data.get(
'installation-name', 'default'))
XML.SubElement(xwrapper, 'autoDisplayName').text = str(data.get(
'auto-display-name', False)).lower()
if 'display-name' in data:
XML.SubElement(xwrapper, 'displayName').text = str(data.get(
'display-name', ''))
XML.SubElement(xwrapper, 'assignedLabels').text = str(data.get(
'assigned-labels', ''))
XML.SubElement(xwrapper, 'parallelBuild').text = str(data.get(
'parallel-build', False)).lower()
XML.SubElement(xwrapper, 'timeout').text = str(data.get('timeout', '0'))
XML.SubElement(xwrapper, 'screen').text = str(data.get(
'screen', '1024x768x24'))
XML.SubElement(xwrapper, 'displayNameOffset').text = str(data.get(
'display-name-offset', '1'))
XML.SubElement(xwrapper, 'additionalOptions').text = str(data.get(
'additional-options', ''))
XML.SubElement(xwrapper, 'debug').text = str(data.get(
'debug', False)).lower()
XML.SubElement(xwrapper, 'shutdownWithBuild').text = str(data.get(
'shutdown-with-build', False)).lower()
class Wrappers(jenkins_jobs.modules.base.Base):
sequence = 80

View File

@ -244,6 +244,7 @@ jenkins_jobs.wrappers =
timeout=jenkins_jobs.modules.wrappers:timeout
timestamps=jenkins_jobs.modules.wrappers:timestamps
workspace-cleanup=jenkins_jobs.modules.wrappers:workspace_cleanup
xvfb=jenkins_jobs.modules.wrappers:xvfb
xvnc=jenkins_jobs.modules.wrappers:xvnc
jenkins_jobs.modules =
builders=jenkins_jobs.modules.builders:Builders

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<buildWrappers>
<org.jenkinsci.plugins.xvfb.XvfbBuildWrapper>
<installationName>default</installationName>
<autoDisplayName>false</autoDisplayName>
<displayName>123</displayName>
<assignedLabels>nodes-xxx</assignedLabels>
<parallelBuild>false</parallelBuild>
<timeout>10</timeout>
<screen>1024x768x16</screen>
<displayNameOffset>100</displayNameOffset>
<additionalOptions>-fbdir /tmp</additionalOptions>
<debug>true</debug>
<shutdownWithBuild>false</shutdownWithBuild>
</org.jenkinsci.plugins.xvfb.XvfbBuildWrapper>
</buildWrappers>
</project>

View File

@ -0,0 +1,13 @@
wrappers:
- xvfb:
installation-name: default
auto-display-name: false
display-name: 123
assigned-labels: nodes-xxx
parallel-build: false
timeout: 10
screen: 1024x768x16
display-name-offset: 100
additional-options: -fbdir /tmp
debug: true
shutdown-with-build: false

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<buildWrappers>
<org.jenkinsci.plugins.xvfb.XvfbBuildWrapper>
<installationName>default</installationName>
<autoDisplayName>false</autoDisplayName>
<assignedLabels/>
<parallelBuild>false</parallelBuild>
<timeout>0</timeout>
<screen>1024x768x24</screen>
<displayNameOffset>1</displayNameOffset>
<additionalOptions/>
<debug>false</debug>
<shutdownWithBuild>false</shutdownWithBuild>
</org.jenkinsci.plugins.xvfb.XvfbBuildWrapper>
</buildWrappers>
</project>

View File

@ -0,0 +1,2 @@
wrappers:
- xvfb