diff --git a/jenkins_jobs/modules/general.py b/jenkins_jobs/modules/general.py index 99fc7c03a..35e9f10ce 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 000000000..16b7b4be5 --- /dev/null +++ b/tests/general/fixtures/custom-workspace001.xml @@ -0,0 +1,10 @@ + + + + false + false + false + false + foo + true + diff --git a/tests/general/fixtures/custom-workspace001.yaml b/tests/general/fixtures/custom-workspace001.yaml new file mode 100644 index 000000000..6e641323c --- /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 000000000..a3a266b65 --- /dev/null +++ b/tests/general/fixtures/custom-workspace002.xml @@ -0,0 +1,16 @@ + + + + false + + + + + false + false + false + false + foo + bar + true + diff --git a/tests/general/fixtures/custom-workspace002.yaml b/tests/general/fixtures/custom-workspace002.yaml new file mode 100644 index 000000000..a64ac8a8f --- /dev/null +++ b/tests/general/fixtures/custom-workspace002.yaml @@ -0,0 +1,3 @@ +project-type: matrix +workspace: foo +child-workspace: bar