summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFathi Boudra <fathi.boudra@linaro.org>2014-06-01 19:12:05 +0300
committerFathi Boudra <fathi.boudra@linaro.org>2015-07-13 10:16:58 +0300
commitb72b10dd445d0a194cc7044098cdc995c5d0c0a1 (patch)
treee133f14456fabb033bdc00ec60de4b1187a5c8d1
parent9e0ef50a18976d8bd368f41ce4e101f1f212a3b8 (diff)
downloadpython-jenkins-job-builder-b72b10dd445d0a194cc7044098cdc995c5d0c0a1.tar.gz
python-jenkins-job-builder-b72b10dd445d0a194cc7044098cdc995c5d0c0a1.tar.xz
python-jenkins-job-builder-b72b10dd445d0a194cc7044098cdc995c5d0c0a1.zip
general: add support for childCustomWorkspace
On freestyle project, we can set custom workspace. On matrix project, we can set custom workspace and child custom workspace. It allows to specify the directory for sub-builds. Change-Id: Icef3831174ff805e86f1ece84fef9a438f465691 Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
-rw-r--r--jenkins_jobs/modules/general.py7
-rw-r--r--tests/general/fixtures/custom-workspace001.xml10
-rw-r--r--tests/general/fixtures/custom-workspace001.yaml3
-rw-r--r--tests/general/fixtures/custom-workspace002.xml16
-rw-r--r--tests/general/fixtures/custom-workspace002.yaml3
5 files changed, 39 insertions, 0 deletions
diff --git a/jenkins_jobs/modules/general.py b/jenkins_jobs/modules/general.py
index 99fc7c03..35e9f10c 100644
--- a/jenkins_jobs/modules/general.py
+++ b/jenkins_jobs/modules/general.py
@@ -56,6 +56,10 @@ Example:
Path for a custom workspace. Defaults to Jenkins default
configuration.
+ * **child-workspace**:
+ Path for a child custom workspace. Defaults to Jenkins default
+ configuration. This parameter is only valid for matrix type jobs.
+
* **quiet-period**:
Number of seconds to wait between consecutive runs of this job.
Defaults to ``0``.
@@ -139,6 +143,9 @@ class General(jenkins_jobs.modules.base.Base):
if 'workspace' in data:
XML.SubElement(xml, 'customWorkspace').text = \
str(data['workspace'])
+ if (xml.tag == 'matrix-project') and ('child-workspace' in data):
+ XML.SubElement(xml, 'childCustomWorkspace').text = \
+ str(data['child-workspace'])
if 'quiet-period' in data:
XML.SubElement(xml, 'quietPeriod').text = str(data['quiet-period'])
node = data.get('node', None)
diff --git a/tests/general/fixtures/custom-workspace001.xml b/tests/general/fixtures/custom-workspace001.xml
new file mode 100644
index 00000000..16b7b4be
--- /dev/null
+++ b/tests/general/fixtures/custom-workspace001.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project>
+ <actions/>
+ <keepDependencies>false</keepDependencies>
+ <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
+ <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
+ <concurrentBuild>false</concurrentBuild>
+ <customWorkspace>foo</customWorkspace>
+ <canRoam>true</canRoam>
+</project>
diff --git a/tests/general/fixtures/custom-workspace001.yaml b/tests/general/fixtures/custom-workspace001.yaml
new file mode 100644
index 00000000..6e641323
--- /dev/null
+++ b/tests/general/fixtures/custom-workspace001.yaml
@@ -0,0 +1,3 @@
+project-type: freestyle
+workspace: foo
+child-workspace: bar
diff --git a/tests/general/fixtures/custom-workspace002.xml b/tests/general/fixtures/custom-workspace002.xml
new file mode 100644
index 00000000..a3a266b6
--- /dev/null
+++ b/tests/general/fixtures/custom-workspace002.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<matrix-project>
+ <executionStrategy class="hudson.matrix.DefaultMatrixExecutionStrategyImpl">
+ <runSequentially>false</runSequentially>
+ </executionStrategy>
+ <combinationFilter/>
+ <axes/>
+ <actions/>
+ <keepDependencies>false</keepDependencies>
+ <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
+ <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
+ <concurrentBuild>false</concurrentBuild>
+ <customWorkspace>foo</customWorkspace>
+ <childCustomWorkspace>bar</childCustomWorkspace>
+ <canRoam>true</canRoam>
+</matrix-project>
diff --git a/tests/general/fixtures/custom-workspace002.yaml b/tests/general/fixtures/custom-workspace002.yaml
new file mode 100644
index 00000000..a64ac8a8
--- /dev/null
+++ b/tests/general/fixtures/custom-workspace002.yaml
@@ -0,0 +1,3 @@
+project-type: matrix
+workspace: foo
+child-workspace: bar