From df1a4e762a9eee97e0239a2c66217b5fc6e9452d Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Wed, 27 Mar 2019 13:27:19 -0400 Subject: [PATCH] Allow jjb-workers to be configurable Default it to the number of CPU cores available on the system. Issue: RELENG-917 Change-Id: I5f65ec7d7142f1a778b6e31cc6700ca2bca1ef88 Signed-off-by: Thanh Ha --- docs/jjb/lf-ci-jobs.rst | 2 ++ jjb/lf-ci-jobs.yaml | 4 ++++ releasenotes/notes/jjb-workers-9459a54a5ecb91e8.yaml | 6 ++++++ shell/jjb-merge-job.sh | 4 +++- 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/jjb-workers-9459a54a5ecb91e8.yaml diff --git a/docs/jjb/lf-ci-jobs.rst b/docs/jjb/lf-ci-jobs.rst index 6184284f..5ad9b6a3 100644 --- a/docs/jjb/lf-ci-jobs.rst +++ b/docs/jjb/lf-ci-jobs.rst @@ -424,6 +424,8 @@ Runs `jenkins-jobs update` to update production job configuration :build-timeout: Timeout in minutes before aborting build. (default: 10) :git-url: URL clone project from. (default: $GIT_URL/$PROJECT) :jjb-cache: JJB cache location. (default: $HOME/.cache/jenkins_jobs) + :jjb-workers: Number of threads to run **update** with. Set to 0 by default + which is equivalent to the number of available CPU cores. (default: 0) :jjb-version: JJB version to install. (default: see job-template) :stream: Keyword that can be used to represent a release code-name. Often the same as the branch. (default: master) diff --git a/jjb/lf-ci-jobs.yaml b/jjb/lf-ci-jobs.yaml index 8a49d036..ebf637fd 100644 --- a/jjb/lf-ci-jobs.yaml +++ b/jjb/lf-ci-jobs.yaml @@ -719,6 +719,8 @@ # Default parameters # ###################### + jjb-workers: 0 + gerrit_merge_triggers: - change-merged-event - comment-added-contains-event: @@ -731,6 +733,8 @@ builders: - lf-infra-pre-build - lf-infra-jjbini + - inject: + properties-content: JJB_WORKERS={jjb-workers} - shell: !include-raw-escape: - ../shell/jjb-install.sh - ../shell/jjb-merge-job.sh diff --git a/releasenotes/notes/jjb-workers-9459a54a5ecb91e8.yaml b/releasenotes/notes/jjb-workers-9459a54a5ecb91e8.yaml new file mode 100644 index 00000000..fc11d250 --- /dev/null +++ b/releasenotes/notes/jjb-workers-9459a54a5ecb91e8.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + The **jjb-merge** job now has a new parameter ``jjb-workers`` to allow + configuration of the number of threads to run update with. Default is *0* + which is equivalent to the number of CPU cores available on the system. diff --git a/shell/jjb-merge-job.sh b/shell/jjb-merge-job.sh index 090e9153..0a05c4f0 100644 --- a/shell/jjb-merge-job.sh +++ b/shell/jjb-merge-job.sh @@ -10,7 +10,9 @@ ############################################################################## echo "---> jjb-merge-job.sh" +workers="${JJB_WORKERS:-0}" + # Ensure we fail the job if any steps fail. set -eu -o pipefail -jenkins-jobs update --recursive --delete-old --workers 4 jjb/ +jenkins-jobs update --recursive --delete-old --workers "$workers" jjb/ -- 2.16.6