From 97635cfbdde04e813ed2aab65c7bce01fc2e274e Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Wed, 4 Nov 2015 12:29:22 -0500 Subject: [PATCH] Add matrixOptions to throttle properties module Change-Id: Id5021ed55a45ca951b9a24f5790f4a7313b1dff1 --- jenkins_jobs/modules/properties.py | 8 ++++++++ tests/properties/fixtures/throttle001.xml | 4 ++++ tests/properties/fixtures/throttle001.yaml | 2 ++ tests/properties/fixtures/throttle002.xml | 4 ++++ 4 files changed, 18 insertions(+) diff --git a/jenkins_jobs/modules/properties.py b/jenkins_jobs/modules/properties.py index 1f91b29e9..5c91bb721 100644 --- a/jenkins_jobs/modules/properties.py +++ b/jenkins_jobs/modules/properties.py @@ -167,6 +167,8 @@ def throttle(parser, xml_parent, data): :arg bool enabled: whether throttling is enabled (default true) :arg str option: throttle `project` or `category` :arg list categories: multiproject throttle categories + :arg bool matrix-builds: throttle matrix master builds (default true) + :arg bool matrix-configs: throttle matrix config builds (default false) Example: @@ -195,6 +197,12 @@ def throttle(parser, xml_parent, data): XML.SubElement(throttle, 'throttleOption').text = data.get('option') XML.SubElement(throttle, 'configVersion').text = '1' + matrixopt = XML.SubElement(throttle, 'matrixOptions') + XML.SubElement(matrixopt, 'throttleMatrixBuilds').text = str( + data.get('matrix-builds', True)).lower() + XML.SubElement(matrixopt, 'throttleMatrixConfigurations').text = str( + data.get('matrix-configs', False)).lower() + def sidebar(parser, xml_parent, data): """yaml: sidebar diff --git a/tests/properties/fixtures/throttle001.xml b/tests/properties/fixtures/throttle001.xml index 2c9357a65..829eff1c6 100644 --- a/tests/properties/fixtures/throttle001.xml +++ b/tests/properties/fixtures/throttle001.xml @@ -11,6 +11,10 @@ category 1 + + false + true + diff --git a/tests/properties/fixtures/throttle001.yaml b/tests/properties/fixtures/throttle001.yaml index b7e04aa53..50b4658be 100644 --- a/tests/properties/fixtures/throttle001.yaml +++ b/tests/properties/fixtures/throttle001.yaml @@ -6,3 +6,5 @@ properties: - cat1 - cat2 option: category + matrix-builds: false + matrix-configs: true diff --git a/tests/properties/fixtures/throttle002.xml b/tests/properties/fixtures/throttle002.xml index 7e3d0a378..48373a76b 100644 --- a/tests/properties/fixtures/throttle002.xml +++ b/tests/properties/fixtures/throttle002.xml @@ -11,6 +11,10 @@ project 1 + + true + false +