Merge "Add support for GroovyAxis"
This commit is contained in:
commit
5233fad79b
@ -28,11 +28,12 @@ internal YAML structure:
|
||||
Requires the Jenkins :jenkins-wiki:`Matrix Project Plugin
|
||||
<Matrix+Project+Plugin>`.
|
||||
|
||||
The module supports also dynamic axis:
|
||||
The module also supports additional, plugin-defined axes:
|
||||
|
||||
* dynamic (``dynamic``)
|
||||
|
||||
Requires the Jenkins :jenkins-wiki:`dynamic axis Plugin <DynamicAxis+Plugin>`.
|
||||
* DynamicAxis (``dynamic``), requires the Jenkins
|
||||
:jenkins-wiki:`DynamicAxis Plugin <DynamicAxis+Plugin>`
|
||||
* GroovyAxis (``groovy``), requires the Jenkins
|
||||
:jenkins-wiki:`GroovyAxis Plugin <GroovyAxis>`
|
||||
|
||||
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
|
||||
@ -85,6 +86,7 @@ class Matrix(jenkins_jobs.modules.base.Base):
|
||||
'dynamic': 'ca.silvermaplesolutions.jenkins.plugins.daxis.DynamicAxis',
|
||||
'python': 'jenkins.plugins.shiningpanda.matrix.PythonAxis',
|
||||
'tox': 'jenkins.plugins.shiningpanda.matrix.ToxAxis',
|
||||
'groovy': 'org.jenkinsci.plugins.GroovyAxis',
|
||||
}
|
||||
|
||||
def root_xml(self, data):
|
||||
@ -132,12 +134,17 @@ class Matrix(jenkins_jobs.modules.base.Base):
|
||||
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 != "groovy":
|
||||
v_root = XML.SubElement(lbl_root, 'values')
|
||||
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')
|
||||
XML.SubElement(v_root, 'string').text = 'default'
|
||||
elif axis_type == "groovy":
|
||||
command = XML.SubElement(lbl_root, 'groovyString')
|
||||
command.text = axis.get('command')
|
||||
XML.SubElement(lbl_root, 'computedValues').text = ''
|
||||
else:
|
||||
for v in values:
|
||||
XML.SubElement(v_root, 'string').text = str(v)
|
||||
|
30
tests/general/fixtures/matrix-axis005.xml
Normal file
30
tests/general/fixtures/matrix-axis005.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<matrix-project>
|
||||
<executionStrategy class="hudson.matrix.DefaultMatrixExecutionStrategyImpl">
|
||||
<runSequentially>false</runSequentially>
|
||||
</executionStrategy>
|
||||
<combinationFilter/>
|
||||
<axes>
|
||||
<ca.silvermaplesolutions.jenkins.plugins.daxis.DynamicAxis>
|
||||
<name>config</name>
|
||||
<values>
|
||||
<string>config_list</string>
|
||||
</values>
|
||||
<varName>config_list</varName>
|
||||
<axisValues>
|
||||
<string>default</string>
|
||||
</axisValues>
|
||||
</ca.silvermaplesolutions.jenkins.plugins.daxis.DynamicAxis>
|
||||
<org.jenkinsci.plugins.GroovyAxis>
|
||||
<name>foo</name>
|
||||
<groovyString>return [bar,baz]</groovyString>
|
||||
<computedValues/>
|
||||
</org.jenkinsci.plugins.GroovyAxis>
|
||||
</axes>
|
||||
<actions/>
|
||||
<keepDependencies>false</keepDependencies>
|
||||
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
||||
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
||||
<concurrentBuild>false</concurrentBuild>
|
||||
<canRoam>true</canRoam>
|
||||
</matrix-project>
|
12
tests/general/fixtures/matrix-axis005.yaml
Normal file
12
tests/general/fixtures/matrix-axis005.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
name: matrix-test005
|
||||
project-type: matrix
|
||||
axes:
|
||||
- axis:
|
||||
type: dynamic
|
||||
name: config
|
||||
values:
|
||||
- config_list
|
||||
- axis:
|
||||
type: groovy
|
||||
name: foo
|
||||
command: 'return [bar,baz]'
|
@ -50,6 +50,11 @@
|
||||
<string>sqlite</string>
|
||||
</values>
|
||||
</hudson.matrix.TextAxis>
|
||||
<org.jenkinsci.plugins.GroovyAxis>
|
||||
<name>foo</name>
|
||||
<groovyString>return [one,two,three]</groovyString>
|
||||
<computedValues/>
|
||||
</org.jenkinsci.plugins.GroovyAxis>
|
||||
</axes>
|
||||
<actions/>
|
||||
<description><!-- Managed by Jenkins Job Builder --></description>
|
||||
|
@ -39,5 +39,9 @@
|
||||
- mysql
|
||||
- postgresql
|
||||
- sqlite
|
||||
- axis:
|
||||
type: groovy
|
||||
name: foo
|
||||
command: return [one,two,three]
|
||||
builders:
|
||||
- shell: make && make check
|
||||
|
Loading…
x
Reference in New Issue
Block a user