Allow to set plugin_properties
This patch allows to configure plugin properties for
throttleconcurrent build plugin.
Change-Id: Id188c1796ba877df5216b6d686250aee604030f2
Related-Prod: PROD-16928
diff --git a/README.rst b/README.rst
index e45c4b8..ec59304 100644
--- a/README.rst
+++ b/README.rst
@@ -448,7 +448,7 @@
.. code-block:: yaml
-
+
jenkins:
client:
plugin:
@@ -458,6 +458,27 @@
enabled: false
restart: true
+Adding plugin params to job
+
+.. code-block:: yaml
+
+
+ jenkins:
+ client:
+ job:
+ my_plugin_parametrized_job:
+ plugin_properties:
+ throttleconcurrents:
+ enabled: True
+ max_concurrent_per_node: 3
+ max_concurrent_total: 5
+ plugin:
+ swarm:
+ restart: false
+ hipchat:
+ enabled: false
+ restart: true
+
LDAP configuration (depends on LDAP plugin)
.. code-block:: yaml
@@ -551,7 +572,7 @@
Credentials enforcing from client
.. code-block:: yaml
-
+
jenkins:
client:
credential:
@@ -612,7 +633,7 @@
ret_strategy: Always
labels:
- example
- - label
+ - label
launcher:
type: ssh
host: test-launcher
diff --git a/jenkins/files/jobs/_common.xml b/jenkins/files/jobs/_common.xml
index 6fe125a..9a89191 100644
--- a/jenkins/files/jobs/_common.xml
+++ b/jenkins/files/jobs/_common.xml
@@ -181,6 +181,7 @@
</triggers>
</org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
{%- include "jenkins/files/jobs/_parameters.xml" %}
+ {%- include "jenkins/files/jobs/_plugin_properties.xml" %}
</properties>
<triggers>
</triggers>
diff --git a/jenkins/files/jobs/_plugin_properties.xml b/jenkins/files/jobs/_plugin_properties.xml
new file mode 100755
index 0000000..4234a67
--- /dev/null
+++ b/jenkins/files/jobs/_plugin_properties.xml
@@ -0,0 +1,13 @@
+{%- if job.plugin_properties is defined %}
+ {%- if job.plugin_properties.get('throttleconcurrents', {}).get('enabled', False) %}
+ <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"/>
+ <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>
+ <paramsToUseForLimit></paramsToUseForLimit>
+ </hudson.plugins.throttleconcurrents.ThrottleJobProperty>
+ {%- endif %}
+{%- endif %}