From 99583eccc4cd23f25c67010c780f0715386f7148 Mon Sep 17 00:00:00 2001 From: dayanjer Date: Sun, 6 Mar 2016 11:45:31 +0000 Subject: [PATCH] add support for node-parameters option for multijob builder Change-Id: Ie7e2e12137fcfbe55937b8972b4fc5d538f817f2 --- jenkins_jobs/modules/builders.py | 7 +++++++ tests/builders/fixtures/multibuild.xml | 1 + tests/builders/fixtures/multibuild.yaml | 1 + 3 files changed, 9 insertions(+) diff --git a/jenkins_jobs/modules/builders.py b/jenkins_jobs/modules/builders.py index 1796aea21..aecf73b32 100644 --- a/jenkins_jobs/modules/builders.py +++ b/jenkins_jobs/modules/builders.py @@ -1563,6 +1563,8 @@ def multijob(parser, xml_parent, data): * **node-label** (`str`) -- Define a label of 'Restrict where this project can be run' on the fly. Requires NodeLabel Parameter Plugin (optional) + * **node-parameters** (`bool`) -- Use the same Node for + the triggered builds that was used for this build. (optional) * **git-revision** (`bool`) -- Pass current git-revision to the other job (default false) * **property-file** (`str`) -- Pass properties from file @@ -1622,6 +1624,11 @@ def multijob(parser, xml_parent, data): XML.SubElement(node, 'name').text = nodeLabelName XML.SubElement(node, 'nodeLabel').text = nodeLabel + # Node parameter + if project.get('node-parameters', False): + XML.SubElement(configs, 'hudson.plugins.parameterizedtrigger.' + 'NodeParameters') + # Git Revision if project.get('git-revision', False): param = XML.SubElement(configs, diff --git a/tests/builders/fixtures/multibuild.xml b/tests/builders/fixtures/multibuild.xml index bdfe478d1..f2fe77f87 100644 --- a/tests/builders/fixtures/multibuild.xml +++ b/tests/builders/fixtures/multibuild.xml @@ -40,6 +40,7 @@ PhaseTwoJobA true + foo=bar diff --git a/tests/builders/fixtures/multibuild.yaml b/tests/builders/fixtures/multibuild.yaml index 557d815df..fe4039665 100644 --- a/tests/builders/fixtures/multibuild.yaml +++ b/tests/builders/fixtures/multibuild.yaml @@ -19,6 +19,7 @@ builders: - name: PhaseTwoJobA current-parameters: true predefined-parameters: foo=bar + node-parameters: true - name: PhaseTwoJobB current-parameters: false kill-phase-on: UNSTABLE