Merge "Add matching parameter to throttle concurrent jobs"

This commit is contained in:
Zuul 2018-08-02 09:36:53 +00:00 committed by Gerrit Code Review
commit b23394b47b
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'