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 list categories: multiproject throttle categories
:arg bool matrix-builds: throttle matrix master builds (default true) :arg bool matrix-builds: throttle matrix master builds (default true)
:arg bool matrix-configs: throttle matrix config builds (default false) :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: Example:
@ -269,6 +273,7 @@ def throttle(registry, xml_parent, data):
mapping = [ mapping = [
('', 'throttleOption', option), ('', 'throttleOption', option),
('', 'configVersion', '1'), ('', 'configVersion', '1'),
('parameters-limit', 'limitOneJobWithMatchingParams', False),
] ]
helpers.convert_mapping_to_xml(throttle, data, mapping, fail_required=True) 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( helpers.convert_mapping_to_xml(
matrixopt, data, mapping, fail_required=True) 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): def branch_api(registry, xml_parent, data):
"""yaml: branch-api """yaml: branch-api

View File

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

View File

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

View File

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