Add matching parameter to throttle concurrent jobs

Change-Id: I6d211508d774df2312942d56a840bf311bb455d4
Co-Authored-By: Tan Heng Yeow <E0032242@u.nus.edu>
Signed-off-by: Tan Heng Yeow <E0032242@u.nus.edu>
This commit is contained in:
akulakhan 2016-11-29 14:44:31 -08:00 committed by tanhengyeow
parent c33dbaaaae
commit e9702144be
4 changed files with 17 additions and 0 deletions

View File

@ -241,6 +241,10 @@ def throttle(registry, xml_parent, data):
: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)
:arg str parameters-limit: prevent jobs with matching parameters from
running concurrently (default false)
:arg list parameters-check-list: Comma-separated list of parameters
to use when comparing jobs (optional)
Example:
@ -269,6 +273,7 @@ def throttle(registry, xml_parent, data):
mapping = [
('', 'throttleOption', option),
('', 'configVersion', '1'),
('parameters-limit', 'limitOneJobWithMatchingParams', False),
]
helpers.convert_mapping_to_xml(throttle, data, mapping, fail_required=True)
@ -280,6 +285,10 @@ def throttle(registry, xml_parent, data):
helpers.convert_mapping_to_xml(
matrixopt, data, mapping, fail_required=True)
params_to_use = data.get('parameters-check-list', [])
XML.SubElement(throttle, 'paramsToUseForLimit').text = ",".join(
params_to_use)
def branch_api(registry, xml_parent, data):
"""yaml: branch-api

View File

@ -11,10 +11,12 @@
</categories>
<throttleOption>category</throttleOption>
<configVersion>1</configVersion>
<limitOneJobWithMatchingParams>false</limitOneJobWithMatchingParams>
<matrixOptions>
<throttleMatrixBuilds>false</throttleMatrixBuilds>
<throttleMatrixConfigurations>true</throttleMatrixConfigurations>
</matrixOptions>
<paramsToUseForLimit/>
</hudson.plugins.throttleconcurrents.ThrottleJobProperty>
</properties>
</project>

View File

@ -11,10 +11,12 @@
</categories>
<throttleOption>project</throttleOption>
<configVersion>1</configVersion>
<limitOneJobWithMatchingParams>true</limitOneJobWithMatchingParams>
<matrixOptions>
<throttleMatrixBuilds>true</throttleMatrixBuilds>
<throttleMatrixConfigurations>false</throttleMatrixConfigurations>
</matrixOptions>
<paramsToUseForLimit>param1,param2</paramsToUseForLimit>
</hudson.plugins.throttleconcurrents.ThrottleJobProperty>
</properties>
</project>

View File

@ -4,3 +4,7 @@ properties:
- cat1
- cat2
option: project
parameters-limit: true
parameters-check-list:
- 'param1'
- 'param2'