add support for python and tox matrix project axis

Change-Id: I89ffc04faed02fd72c934b44b6832bd1f11d8f2e
Signed-off-by: Kyle Rockman <kyle.rockman@mac.com>
This commit is contained in:
Kyle Rockman
2014-11-12 12:25:33 -06:00
parent 445c73a298
commit f82ab9a021
3 changed files with 69 additions and 5 deletions

View File

@@ -46,6 +46,15 @@ Requires the Jenkins `dynamic axis Plugin.
* **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:
@@ -100,6 +109,7 @@ Example using user-defined axis::
- sqlite
builders:
- shell: make "$database"
"""
@@ -116,6 +126,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):
@@ -148,15 +160,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')