Adds matrix restriction to trigger-builds plugin

This commit adds restrict-matrix-project option to the trigger-builds
plugin. This option allows you to restrict the subset of the
combinations that the triggered job will run.

Change-Id: I2df3349e15c37cc9a1cbb7d615ad31bb743cf772
Signed-off-by: Tomas Turek <tturek@redhat.com>
This commit is contained in:
Tomas Turek 2016-06-17 14:07:49 +02:00
parent fda76531d9
commit 453219c72f
3 changed files with 33 additions and 0 deletions

View File

@ -391,6 +391,8 @@ def trigger_builds(parser, xml_parent, data):
:arg str node-label: Label of the nodes where build should be triggered.
Used in conjunction with node-label-name. Requires NodeLabel Parameter
Plugin (optional)
:arg str restrict-matrix-project: Filter that restricts the subset
of the combinations that the triggered job will run (optional)
:arg bool svn-revision: Whether to pass the svn revision to the triggered
job (optional)
:arg dict git-revision: Passes git revision to the triggered job
@ -545,6 +547,13 @@ def trigger_builds(parser, xml_parent, data):
XML.SubElement(node, 'name').text = project_def['node-label-name']
XML.SubElement(node, 'nodeLabel').text = project_def['node-label']
if 'restrict-matrix-project' in project_def:
params = XML.SubElement(tconfigs,
'hudson.plugins.parameterizedtrigger.'
'matrix.MatrixSubsetBuildParameters')
XML.SubElement(params, 'filter').text = project_def[
'restrict-matrix-project']
if(len(list(tconfigs)) == 0):
tconfigs.set('class', 'java.util.Collections$EmptyList')

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<builders>
<hudson.plugins.parameterizedtrigger.TriggerBuilder>
<configs>
<hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
<configs>
<hudson.plugins.parameterizedtrigger.matrix.MatrixSubsetBuildParameters>
<filter>label==&quot;x86&quot;</filter>
</hudson.plugins.parameterizedtrigger.matrix.MatrixSubsetBuildParameters>
</configs>
<projects>build_started</projects>
<condition>ALWAYS</condition>
<triggerWithNoParameters>false</triggerWithNoParameters>
<buildAllNodesWithLabel>false</buildAllNodesWithLabel>
</hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
</configs>
</hudson.plugins.parameterizedtrigger.TriggerBuilder>
</builders>
</project>

View File

@ -0,0 +1,4 @@
builders:
- trigger-builds:
- project: "build_started"
restrict-matrix-project: label=="x86"