Merge "Partial support Yaml Axis Plugin"

This commit is contained in:
Jenkins 2016-04-23 14:56:52 +00:00 committed by Gerrit Code Review
commit c2d614f451
3 changed files with 47 additions and 0 deletions

View File

@ -34,6 +34,8 @@ The module also supports additional, plugin-defined axes:
:jenkins-wiki:`DynamicAxis Plugin <DynamicAxis+Plugin>`
* GroovyAxis (``groovy``), requires the Jenkins
:jenkins-wiki:`GroovyAxis Plugin <GroovyAxis>`
* YamlAxis (``yaml``), requires the Jenkins
:jenkins-wiki:`Yaml Axis Plugin <Yaml+Axis+Plugin>`
To tie the parent job to a specific node, you should use ``node`` parameter.
On a matrix project, this will tie *only* the parent job. To restrict axes
@ -67,6 +69,10 @@ Example:
.. literalinclude:: /../../tests/yamlparser/fixtures/project-matrix001.yaml
:language: yaml
Example for yaml axis:
.. literalinclude:: /../../tests/general/fixtures/matrix-axis-yaml.yaml
:language: yaml
"""
import xml.etree.ElementTree as XML
@ -87,6 +93,7 @@ class Matrix(jenkins_jobs.modules.base.Base):
'python': 'jenkins.plugins.shiningpanda.matrix.PythonAxis',
'tox': 'jenkins.plugins.shiningpanda.matrix.ToxAxis',
'groovy': 'org.jenkinsci.plugins.GroovyAxis',
'yaml': 'org.jenkinsci.plugins.yamlaxis.YamlAxis',
}
def root_xml(self, data):
@ -145,6 +152,8 @@ class Matrix(jenkins_jobs.modules.base.Base):
command = XML.SubElement(lbl_root, 'groovyString')
command.text = axis.get('command')
XML.SubElement(lbl_root, 'computedValues').text = ''
elif axis_type == "yaml":
XML.SubElement(v_root, 'string').text = axis.get('filename')
else:
for v in values:
XML.SubElement(v_root, 'string').text = str(v)

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<matrix-project>
<executionStrategy class="hudson.matrix.DefaultMatrixExecutionStrategyImpl">
<runSequentially>false</runSequentially>
</executionStrategy>
<combinationFilter/>
<axes>
<org.jenkinsci.plugins.yamlaxis.YamlAxis>
<name>python</name>
<values>
<string>config.yaml</string>
</values>
</org.jenkinsci.plugins.yamlaxis.YamlAxis>
<org.jenkinsci.plugins.yamlaxis.YamlAxis>
<name>database</name>
<values>
<string>config.yaml</string>
</values>
</org.jenkinsci.plugins.yamlaxis.YamlAxis>
</axes>
<actions/>
<keepDependencies>false</keepDependencies>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<concurrentBuild>false</concurrentBuild>
<canRoam>true</canRoam>
</matrix-project>

View File

@ -0,0 +1,11 @@
name: matrix-with-yaml-axis
project-type: matrix
axes:
- axis:
type: yaml
filename: config.yaml
name: python
- axis:
type: yaml
filename: config.yaml
name: database