Allow to set throttle category to the job
This patch allows to map specific job with pre-created
category.
Change-Id: Ie5ec841af6a1d73959e760471d7ed00ac7c3f882
diff --git a/README.rst b/README.rst
index ec59304..41520e3 100644
--- a/README.rst
+++ b/README.rst
@@ -471,7 +471,10 @@
throttleconcurrents:
enabled: True
max_concurrent_per_node: 3
- max_concurrent_total: 5
+ max_concurrent_total: 1
+ throttle_option: category #one of project (default or category)
+ categories:
+ - my_throuttle_category
plugin:
swarm:
restart: false
diff --git a/jenkins/files/jobs/_plugin_properties.xml b/jenkins/files/jobs/_plugin_properties.xml
index 4234a67..c548071 100755
--- a/jenkins/files/jobs/_plugin_properties.xml
+++ b/jenkins/files/jobs/_plugin_properties.xml
@@ -3,7 +3,11 @@
<hudson.plugins.throttleconcurrents.ThrottleJobProperty plugin="throttle-concurrents@{{ job.plugin_properties.throttleconcurrents.get('version', '2.0.1') }}">
<maxConcurrentPerNode>{{ job.plugin_properties.throttleconcurrents.get('max_concurrent_per_node', 0) }}</maxConcurrentPerNode>
<maxConcurrentTotal>{{ job.plugin_properties.throttleconcurrents.get('max_concurrent_total', 0) }}</maxConcurrentTotal>
- <categories class="java.util.concurrent.CopyOnWriteArrayList"/>
+ <categories class="java.util.concurrent.CopyOnWriteArrayList">
+ {%- for cat_name in job.plugin_properties.throttleconcurrents.get('categories', []) %}
+ <string>{{ cat_name }}</string>
+ {%- endfor %}
+ </categories>
<throttleEnabled>true</throttleEnabled>
<throttleOption>{{ job.plugin_properties.throttleconcurrents.get('throttle_option', 'project') }}</throttleOption>
<limitOneJobWithMatchingParams>{{ job.plugin_properties.throttleconcurrents.get('limit_one_job_with_matching_params', false) }}</limitOneJobWithMatchingParams>