From d0b4b64aa4c1ced7c3c07b5fb8f50613e40b3baa Mon Sep 17 00:00:00 2001 From: Trevor Bramwell Date: Thu, 8 Nov 2018 21:43:54 -0800 Subject: [PATCH] Add Throttle Property to JJB jobs 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 --- .jjb-test/lf-ci-jobs.yaml | 15 +++++++++++++++ docs/jjb/lf-ci-jobs.rst | 9 +++++++++ jjb/lf-ci-jobs.yaml | 11 +++++++++++ releasenotes/notes/throttle-jjb-f9589760648e067d.yaml | 11 +++++++++++ 4 files changed, 46 insertions(+) create mode 100644 releasenotes/notes/throttle-jjb-f9589760648e067d.yaml diff --git a/.jjb-test/lf-ci-jobs.yaml b/.jjb-test/lf-ci-jobs.yaml index 5e716d9f..c88fa926 100644 --- a/.jjb-test/lf-ci-jobs.yaml +++ b/.jjb-test/lf-ci-jobs.yaml @@ -68,6 +68,21 @@ - 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: diff --git a/docs/jjb/lf-ci-jobs.rst b/docs/jjb/lf-ci-jobs.rst index 79c09296..6184284f 100644 --- a/docs/jjb/lf-ci-jobs.rst +++ b/docs/jjb/lf-ci-jobs.rst @@ -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 diff --git a/jjb/lf-ci-jobs.yaml b/jjb/lf-ci-jobs.yaml index 925ec4ed..8a49d036 100644 --- a/jjb/lf-ci-jobs.yaml +++ b/jjb/lf-ci-jobs.yaml @@ -113,6 +113,11 @@ 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 @@ -140,6 +145,12 @@ - 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 index 00000000..ee2da33d --- /dev/null +++ b/releasenotes/notes/throttle-jjb-f9589760648e067d.yaml @@ -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 -- 2.16.6