summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakeshi Kanemoto <takeshi.kanemoto@sonymobile.com>2014-02-26 18:05:07 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2014-04-08 10:57:24 +0900
commit4a1bc78272736e784e9148286d3119c181bb90c1 (patch)
tree7f88140ac2beae01b199f950a46750211d871812
parent1b88a66db28bb84cb6f709073de03a51ab28412b (diff)
downloadpython-jenkins-job-builder-4a1bc78272736e784e9148286d3119c181bb90c1.tar.gz
python-jenkins-job-builder-4a1bc78272736e784e9148286d3119c181bb90c1.tar.xz
python-jenkins-job-builder-4a1bc78272736e784e9148286d3119c181bb90c1.zip
Support Matrix Tie Parent Plugin in wrappers
Change-Id: I9c55ed443496bf4573969f83750c46bd678290a7
-rw-r--r--jenkins_jobs/modules/wrappers.py18
-rw-r--r--setup.cfg1
-rw-r--r--tests/wrappers/fixtures/matrix-tie-parent.xml13
-rw-r--r--tests/wrappers/fixtures/matrix-tie-parent.yaml4
4 files changed, 36 insertions, 0 deletions
diff --git a/jenkins_jobs/modules/wrappers.py b/jenkins_jobs/modules/wrappers.py
index af273485..c9b3db08 100644
--- a/jenkins_jobs/modules/wrappers.py
+++ b/jenkins_jobs/modules/wrappers.py
@@ -951,6 +951,24 @@ def delivery_pipeline(parser, xml_parent, data):
'set-display-name', False)).lower()
+def matrix_tie_parent(parser, xml_parent, data):
+ """yaml: matrix-tie-parent
+ Tie parent to a node.
+ Requires the Jenkins `Matrix Tie Parent Plugin.
+ <https://wiki.jenkins-ci.org/display/JENKINS/Matrix+Tie+Parent+Plugin>`_
+ Note that from Jenkins version 1.532 this plugin's functionality is
+ available under the "advanced" option of the matrix project configuration.
+
+ :arg str node: Name of the node.
+
+ Example:
+
+ .. literalinclude:: /../../tests/wrappers/fixtures/matrix-tie-parent.yaml
+ """
+ mtp = XML.SubElement(xml_parent, 'matrixtieparent.BuildWrapperMtp')
+ XML.SubElement(mtp, 'labelName').text = data['node']
+
+
class Wrappers(jenkins_jobs.modules.base.Base):
sequence = 80
diff --git a/setup.cfg b/setup.cfg
index c260fa1f..a44d1406 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -176,6 +176,7 @@ jenkins_jobs.wrappers =
locks=jenkins_jobs.modules.wrappers:locks
logstash=jenkins_jobs.modules.wrappers:logstash
mask-passwords=jenkins_jobs.modules.wrappers:mask_passwords
+ matrix-tie-parent=jenkins_jobs.modules.wrappers:matrix_tie_parent
pathignore=jenkins_jobs.modules.wrappers:pathignore
port-allocator=jenkins_jobs.modules.wrappers:port_allocator
pre-scm-buildstep=jenkins_jobs.modules.wrappers:pre_scm_buildstep
diff --git a/tests/wrappers/fixtures/matrix-tie-parent.xml b/tests/wrappers/fixtures/matrix-tie-parent.xml
new file mode 100644
index 00000000..9d2c65b8
--- /dev/null
+++ b/tests/wrappers/fixtures/matrix-tie-parent.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<matrix-project>
+ <executionStrategy class="hudson.matrix.DefaultMatrixExecutionStrategyImpl">
+ <runSequentially>false</runSequentially>
+ </executionStrategy>
+ <combinationFilter/>
+ <axes/>
+ <buildWrappers>
+ <matrixtieparent.BuildWrapperMtp>
+ <labelName>Unix</labelName>
+ </matrixtieparent.BuildWrapperMtp>
+ </buildWrappers>
+</matrix-project>
diff --git a/tests/wrappers/fixtures/matrix-tie-parent.yaml b/tests/wrappers/fixtures/matrix-tie-parent.yaml
new file mode 100644
index 00000000..a518899a
--- /dev/null
+++ b/tests/wrappers/fixtures/matrix-tie-parent.yaml
@@ -0,0 +1,4 @@
+project-type: matrix
+wrappers:
+ - matrix-tie-parent:
+ node: Unix