diff --git a/jenkins_jobs/modules/builders.py b/jenkins_jobs/modules/builders.py index c846a6f9f..5af5b5afa 100644 --- a/jenkins_jobs/modules/builders.py +++ b/jenkins_jobs/modules/builders.py @@ -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') diff --git a/tests/builders/fixtures/trigger-builds008.xml b/tests/builders/fixtures/trigger-builds008.xml new file mode 100644 index 000000000..fed3f0b89 --- /dev/null +++ b/tests/builders/fixtures/trigger-builds008.xml @@ -0,0 +1,20 @@ + + + + + + + + + label=="x86" + + + build_started + ALWAYS + false + false + + + + + diff --git a/tests/builders/fixtures/trigger-builds008.yaml b/tests/builders/fixtures/trigger-builds008.yaml new file mode 100644 index 000000000..dde588b76 --- /dev/null +++ b/tests/builders/fixtures/trigger-builds008.yaml @@ -0,0 +1,4 @@ +builders: + - trigger-builds: + - project: "build_started" + restrict-matrix-project: label=="x86"