Merge "Partial support Yaml Axis Plugin"
This commit is contained in:
commit
c2d614f451
@ -34,6 +34,8 @@ The module also supports additional, plugin-defined axes:
|
|||||||
:jenkins-wiki:`DynamicAxis Plugin <DynamicAxis+Plugin>`
|
:jenkins-wiki:`DynamicAxis Plugin <DynamicAxis+Plugin>`
|
||||||
* GroovyAxis (``groovy``), requires the Jenkins
|
* GroovyAxis (``groovy``), requires the Jenkins
|
||||||
:jenkins-wiki:`GroovyAxis Plugin <GroovyAxis>`
|
: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.
|
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
|
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
|
.. literalinclude:: /../../tests/yamlparser/fixtures/project-matrix001.yaml
|
||||||
:language: yaml
|
:language: yaml
|
||||||
|
|
||||||
|
Example for yaml axis:
|
||||||
|
|
||||||
|
.. literalinclude:: /../../tests/general/fixtures/matrix-axis-yaml.yaml
|
||||||
|
:language: yaml
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import xml.etree.ElementTree as XML
|
import xml.etree.ElementTree as XML
|
||||||
@ -87,6 +93,7 @@ class Matrix(jenkins_jobs.modules.base.Base):
|
|||||||
'python': 'jenkins.plugins.shiningpanda.matrix.PythonAxis',
|
'python': 'jenkins.plugins.shiningpanda.matrix.PythonAxis',
|
||||||
'tox': 'jenkins.plugins.shiningpanda.matrix.ToxAxis',
|
'tox': 'jenkins.plugins.shiningpanda.matrix.ToxAxis',
|
||||||
'groovy': 'org.jenkinsci.plugins.GroovyAxis',
|
'groovy': 'org.jenkinsci.plugins.GroovyAxis',
|
||||||
|
'yaml': 'org.jenkinsci.plugins.yamlaxis.YamlAxis',
|
||||||
}
|
}
|
||||||
|
|
||||||
def root_xml(self, data):
|
def root_xml(self, data):
|
||||||
@ -145,6 +152,8 @@ class Matrix(jenkins_jobs.modules.base.Base):
|
|||||||
command = XML.SubElement(lbl_root, 'groovyString')
|
command = XML.SubElement(lbl_root, 'groovyString')
|
||||||
command.text = axis.get('command')
|
command.text = axis.get('command')
|
||||||
XML.SubElement(lbl_root, 'computedValues').text = ''
|
XML.SubElement(lbl_root, 'computedValues').text = ''
|
||||||
|
elif axis_type == "yaml":
|
||||||
|
XML.SubElement(v_root, 'string').text = axis.get('filename')
|
||||||
else:
|
else:
|
||||||
for v in values:
|
for v in values:
|
||||||
XML.SubElement(v_root, 'string').text = str(v)
|
XML.SubElement(v_root, 'string').text = str(v)
|
||||||
|
27
tests/general/fixtures/matrix-axis-yaml.xml
Normal file
27
tests/general/fixtures/matrix-axis-yaml.xml
Normal 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>
|
11
tests/general/fixtures/matrix-axis-yaml.yaml
Normal file
11
tests/general/fixtures/matrix-axis-yaml.yaml
Normal 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
|
Loading…
x
Reference in New Issue
Block a user