Merge "add support for python and tox matrix project axis"
This commit is contained in:
commit
4bf020e07e
@ -50,6 +50,15 @@ jobs, you can define a single value ``slave`` axis.
|
||||
* **name** (`str`) -- name of the axis
|
||||
* **values** (`list`) -- values of the axis
|
||||
|
||||
The module supports also ShiningPanda axes:
|
||||
|
||||
Example::
|
||||
|
||||
.. literalinclude:: /../../tests/general/fixtures/matrix-axis003.yaml
|
||||
|
||||
Requires the Jenkins `ShiningPanda Plugin.
|
||||
<https://wiki.jenkins-ci.org/display/JENKINS/ShiningPanda+Plugin>`_
|
||||
|
||||
Example::
|
||||
|
||||
- job:
|
||||
@ -104,6 +113,7 @@ Example using user-defined axis::
|
||||
- sqlite
|
||||
builders:
|
||||
- shell: make "$database"
|
||||
|
||||
"""
|
||||
|
||||
|
||||
@ -120,6 +130,8 @@ class Matrix(jenkins_jobs.modules.base.Base):
|
||||
'user-defined': 'hudson.matrix.TextAxis',
|
||||
'slave': 'hudson.matrix.LabelAxis',
|
||||
'dynamic': 'ca.silvermaplesolutions.jenkins.plugins.daxis.DynamicAxis',
|
||||
'python': 'jenkins.plugins.shiningpanda.matrix.PythonAxis',
|
||||
'tox': 'jenkins.plugins.shiningpanda.matrix.ToxAxis',
|
||||
}
|
||||
|
||||
def root_xml(self, data):
|
||||
@ -152,15 +164,21 @@ class Matrix(jenkins_jobs.modules.base.Base):
|
||||
ax_root = XML.SubElement(root, 'axes')
|
||||
for axis_ in data.get('axes', []):
|
||||
axis = axis_['axis']
|
||||
if axis['type'] not in self.supported_axis:
|
||||
axis_type = axis['type']
|
||||
if axis_type not in self.supported_axis:
|
||||
raise ValueError('Only %s axes types are supported'
|
||||
% self.supported_axis.keys())
|
||||
axis_name = self.supported_axis.get(axis['type'])
|
||||
axis_name = self.supported_axis.get(axis_type)
|
||||
lbl_root = XML.SubElement(ax_root, axis_name)
|
||||
name, values = axis['name'], axis['values']
|
||||
XML.SubElement(lbl_root, 'name').text = str(name)
|
||||
name, values = axis.get('name', ''), axis.get('values', [''])
|
||||
if axis_type == 'python':
|
||||
XML.SubElement(lbl_root, 'name').text = 'PYTHON'
|
||||
elif axis_type == 'tox':
|
||||
XML.SubElement(lbl_root, 'name').text = 'TOXENV'
|
||||
else:
|
||||
XML.SubElement(lbl_root, 'name').text = str(name)
|
||||
v_root = XML.SubElement(lbl_root, 'values')
|
||||
if axis['type'] == "dynamic":
|
||||
if axis_type == "dynamic":
|
||||
XML.SubElement(v_root, 'string').text = str(values[0])
|
||||
XML.SubElement(lbl_root, 'varName').text = str(values[0])
|
||||
v_root = XML.SubElement(lbl_root, 'axisValues')
|
||||
|
31
tests/general/fixtures/matrix-axis003.xml
Normal file
31
tests/general/fixtures/matrix-axis003.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<matrix-project>
|
||||
<executionStrategy class="hudson.matrix.DefaultMatrixExecutionStrategyImpl">
|
||||
<runSequentially>false</runSequentially>
|
||||
</executionStrategy>
|
||||
<combinationFilter/>
|
||||
<axes>
|
||||
<jenkins.plugins.shiningpanda.matrix.PythonAxis>
|
||||
<name>PYTHON</name>
|
||||
<values>
|
||||
<string>python-2.6</string>
|
||||
<string>python-2.7</string>
|
||||
<string>python-3.4</string>
|
||||
</values>
|
||||
</jenkins.plugins.shiningpanda.matrix.PythonAxis>
|
||||
<jenkins.plugins.shiningpanda.matrix.ToxAxis>
|
||||
<name>TOXENV</name>
|
||||
<values>
|
||||
<string>py26</string>
|
||||
<string>py27</string>
|
||||
<string>py34</string>
|
||||
</values>
|
||||
</jenkins.plugins.shiningpanda.matrix.ToxAxis>
|
||||
</axes>
|
||||
<actions/>
|
||||
<keepDependencies>false</keepDependencies>
|
||||
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
||||
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
||||
<concurrentBuild>false</concurrentBuild>
|
||||
<canRoam>true</canRoam>
|
||||
</matrix-project>
|
15
tests/general/fixtures/matrix-axis003.yaml
Normal file
15
tests/general/fixtures/matrix-axis003.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
name: matrix-test003
|
||||
project-type: matrix
|
||||
axes:
|
||||
- axis:
|
||||
type: python
|
||||
values:
|
||||
- python-2.6
|
||||
- python-2.7
|
||||
- python-3.4
|
||||
- axis:
|
||||
type: tox
|
||||
values:
|
||||
- py26
|
||||
- py27
|
||||
- py34
|
Loading…
x
Reference in New Issue
Block a user