Add support for the matrix-combinations plugin
This plugin allows a user to choose which matrix combinations they want to run, as opposed to the default behaviour where jenkins runs all combinations Requires the Jenkins Matrix Combinations Plugin: https://wiki.jenkins-ci.org/display/JENKINS/Matrix+Combinations+Plugin Change-Id: I13205c81aa11523a4c3fc373820eb74863d0c7ca
This commit is contained in:
parent
baff62b815
commit
f20aed7ba3
@ -514,6 +514,40 @@ def dynamic_scriptler_param_common(parser, xml_parent, data, ptype):
|
|||||||
'read-only', False)).lower()
|
'read-only', False)).lower()
|
||||||
|
|
||||||
|
|
||||||
|
def matrix_combinations_param(parser, xml_parent, data):
|
||||||
|
"""yaml: matrix-combinations
|
||||||
|
Matrix combinations parameter
|
||||||
|
Requires the Jenkins `Matrix Combinations Plugin.
|
||||||
|
<https://wiki.jenkins-ci.org/display/JENKINS/Matrix+Combinations+Plugin>`_
|
||||||
|
|
||||||
|
:arg str name: the name of the parameter
|
||||||
|
:arg str description: a description of the parameter (optional)
|
||||||
|
:arg str filter: Groovy expression to use filter the combination by
|
||||||
|
default (optional)
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
.. literalinclude:: \
|
||||||
|
/../../tests/parameters/fixtures/matrix-combinations-param001.yaml
|
||||||
|
:language: yaml
|
||||||
|
|
||||||
|
"""
|
||||||
|
element_name = 'hudson.plugins.matrix__configuration__parameter.' \
|
||||||
|
'MatrixCombinationsParameterDefinition'
|
||||||
|
pdef = XML.SubElement(xml_parent, element_name)
|
||||||
|
if 'name' not in data:
|
||||||
|
raise JenkinsJobsException('matrix-combinations must have a name '
|
||||||
|
'parameter.')
|
||||||
|
XML.SubElement(pdef, 'name').text = data['name']
|
||||||
|
XML.SubElement(pdef, 'description').text = data.get('description', '')
|
||||||
|
combination_filter = data.get('filter')
|
||||||
|
if combination_filter:
|
||||||
|
XML.SubElement(pdef, 'defaultCombinationFilter').text = \
|
||||||
|
combination_filter
|
||||||
|
|
||||||
|
return pdef
|
||||||
|
|
||||||
|
|
||||||
class Parameters(jenkins_jobs.modules.base.Base):
|
class Parameters(jenkins_jobs.modules.base.Base):
|
||||||
sequence = 21
|
sequence = 21
|
||||||
|
|
||||||
|
@ -96,6 +96,7 @@ jenkins_jobs.parameters =
|
|||||||
extended-choice=jenkins_jobs.modules.parameters:extended_choice_param
|
extended-choice=jenkins_jobs.modules.parameters:extended_choice_param
|
||||||
file=jenkins_jobs.modules.parameters:file_param
|
file=jenkins_jobs.modules.parameters:file_param
|
||||||
label=jenkins_jobs.modules.parameters:label_param
|
label=jenkins_jobs.modules.parameters:label_param
|
||||||
|
matrix-combinations=jenkins_jobs.modules.parameters:matrix_combinations_param
|
||||||
password=jenkins_jobs.modules.parameters:password_param
|
password=jenkins_jobs.modules.parameters:password_param
|
||||||
run=jenkins_jobs.modules.parameters:run_param
|
run=jenkins_jobs.modules.parameters:run_param
|
||||||
string=jenkins_jobs.modules.parameters:string_param
|
string=jenkins_jobs.modules.parameters:string_param
|
||||||
|
14
tests/parameters/fixtures/matrix-combinations-param001.xml
Normal file
14
tests/parameters/fixtures/matrix-combinations-param001.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<properties>
|
||||||
|
<hudson.model.ParametersDefinitionProperty>
|
||||||
|
<parameterDefinitions>
|
||||||
|
<hudson.plugins.matrix__configuration__parameter.MatrixCombinationsParameterDefinition>
|
||||||
|
<name>FOO</name>
|
||||||
|
<description>Select matrix combinations</description>
|
||||||
|
<defaultCombinationFilter>platform == foo</defaultCombinationFilter>
|
||||||
|
</hudson.plugins.matrix__configuration__parameter.MatrixCombinationsParameterDefinition>
|
||||||
|
</parameterDefinitions>
|
||||||
|
</hudson.model.ParametersDefinitionProperty>
|
||||||
|
</properties>
|
||||||
|
</project>
|
@ -0,0 +1,5 @@
|
|||||||
|
parameters:
|
||||||
|
- matrix-combinations:
|
||||||
|
name: FOO
|
||||||
|
description: "Select matrix combinations"
|
||||||
|
filter: "platform == foo"
|
Loading…
x
Reference in New Issue
Block a user