Add Throttle Property to JJB jobs 81/14781/4
authorTrevor Bramwell <tbramwell@linuxfoundation.org>
Fri, 9 Nov 2018 05:43:54 +0000 (21:43 -0800)
committerTrevor Bramwell <tbramwell@linuxfoundation.org>
Thu, 21 Mar 2019 17:01:34 +0000 (10:01 -0700)
This adds "Throttle Builds" configuration to JJB jobs (verify, merge,
etc) to allow global-jjb users with static builders to limit the number
of jjb jobs ran on a single node.

Issue: RELENG-1510
Change-Id: I00d2950451eae8037ded407937131723b0001179
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
.jjb-test/lf-ci-jobs.yaml
docs/jjb/lf-ci-jobs.rst
jjb/lf-ci-jobs.yaml
releasenotes/notes/throttle-jjb-f9589760648e067d.yaml [new file with mode: 0644]

index 5e716d9..c88fa92 100644 (file)
       - java-builder
       - mininet
 
+- project:
+    name: throttle-ci-jobs
+    jobs:
+      - "{project-name}-ci-jobs"
+
+    throttle-enabled: true
+    throttle_categories:
+      - 'cat1'
+      - 'cat2'
+    throttle-max-per-node: 3
+    throttle-max-total: 2
+    throttle-option: 'category'
+
+    project-name: throttle-ciman
+
 - project:
     name: ci-jobs-view
     views:
index 79c0929..6184284 100644 (file)
@@ -474,6 +474,15 @@ Runs `jenkins-jobs test` to validate JJB syntax
         (default: true)
     :submodule-timeout: Timeout (in minutes) for checkout operation.
         (default: 10)
+    :throttle_categories: List of categories to throttle by.
+    :throttle-enabled: Whether or not to enable throttling on the job.
+        (default: true)
+    :throttle-max-per-node: Max jobs to run on the same node. (default: 1)
+    :throttle-max-total: Max jobs to run across the entire project. - 0
+        means 'unlimited' (default: 0)
+    :throttle-option: Throttle by the project or by list of categories
+        defined in the throttle plugin configuration. (options: 'project',
+        'category'; default: project)
 
     :gerrit_verify_triggers: Override Gerrit Triggers.
     :gerrit_trigger_file_paths: Override file paths which can be used to
index 925ec4e..8a49d03 100644 (file)
     stream: master
     submodule-recursive: true
     submodule-timeout: 10
+    throttle_categories: []
+    throttle-enabled: false
+    throttle-max-per-node: 1
+    throttle-max-total: 0
+    throttle-option: 'project'
 
     gerrit_trigger_file_paths:
       - compare-type: REG_EXP
       - lf-infra-properties:
           project: '{project}'
           build-days-to-keep: 7
+      - throttle:
+          categories: '{obj:throttle_categories}'
+          enabled: '{throttle-enabled}'
+          max-per-node: '{throttle-max-per-node}'
+          max-total: '{throttle-max-total}'
+          option: '{throttle-option}'
 
     parameters:
       - lf-infra-parameters:
diff --git a/releasenotes/notes/throttle-jjb-f9589760648e067d.yaml b/releasenotes/notes/throttle-jjb-f9589760648e067d.yaml
new file mode 100644 (file)
index 0000000..ee2da33
--- /dev/null
@@ -0,0 +1,11 @@
+---
+features:
+  - |
+    Support for the `Throttle Plugin`_ is added to JJB jobs so static
+    build servers can restrict the number of concurrent JJB jobs ran at
+    the same time.
+
+    This must be explicitly enabled by setting `throttle-enabled` on the
+    jobs.
+
+    .. _Throttle Plugin: https://plugins.jenkins.io/throttle-concurrents