From a86c6e8d376c95aa00b179fce9d207e61c8f72d0 Mon Sep 17 00:00:00 2001 From: Eric Ball Date: Thu, 23 Sep 2021 18:54:54 -0700 Subject: [PATCH] Feat: Allow use of newer JDKs for Sonar scans Many builders still default to openjdk8 for java, but Sonarcloud only supports openjdk11+. Issue: RELENG-3964 Signed-off-by: Eric Ball Change-Id: Ida96f7f242a397a60e40e26f910510d665bcf577 --- docs/jjb/lf-ci-jobs.rst | 3 +++ jjb/lf-ci-jobs.yaml | 7 +++++++ releasenotes/notes/set-sonar-java-45f348f714f79c40.yaml | 5 +++++ 3 files changed, 15 insertions(+) create mode 100644 releasenotes/notes/set-sonar-java-45f348f714f79c40.yaml diff --git a/docs/jjb/lf-ci-jobs.rst b/docs/jjb/lf-ci-jobs.rst index e9779409..439b2e73 100644 --- a/docs/jjb/lf-ci-jobs.rst +++ b/docs/jjb/lf-ci-jobs.rst @@ -1000,6 +1000,7 @@ Plug-in configurations :sonar-properties: Sonar configuration properties. (default: "") :sonar-java-opts: JVM options. (default: "") :sonar-additional-args: Additional command line arguments. (default: "") + :sonarcloud-java-version: Version of Java to run the Sonar scan. (default: "openjdk11") Sonar with Prescan @@ -1032,6 +1033,7 @@ to run before the Sonar scan. :sonar-properties: Sonar configuration properties. (default: "") :sonar-java-opts: JVM options. (default: "") :sonar-additional-args: Additional command line arguments. (default: "") + :sonarcloud-java-version: Version of Java to run the Sonar scan. (default: "openjdk11") Sonar with Prescan Script @@ -1057,3 +1059,4 @@ build the project, execute unit tests and generate a code-coverage report. :sonar-properties: Sonar configuration properties. (default: "") :sonar-java-opts: JVM options. (default: "") :sonar-additional-args: Additional command line arguments. (default: "") + :sonarcloud-java-version: Version of Java to run the Sonar scan. (default: "openjdk11") diff --git a/jjb/lf-ci-jobs.yaml b/jjb/lf-ci-jobs.yaml index 6aa84fd1..36965c81 100644 --- a/jjb/lf-ci-jobs.yaml +++ b/jjb/lf-ci-jobs.yaml @@ -2164,6 +2164,7 @@ disable-job: false git-url: "$GIT_URL/$PROJECT" github-url: "https://github.com" + sonarcloud-java-version: openjdk11 stream: master submodule-recursive: true submodule-timeout: 10 @@ -2219,6 +2220,8 @@ name: lf-sonar-builders builders: - lf-infra-pre-build + - lf-update-java-alternatives: + java-version: "{sonarcloud-java-version}" - lf-infra-sonar: sonar-task: "{sonar-task}" sonar-project-file: "{sonar-project-file}" @@ -2230,6 +2233,8 @@ name: lf-sonar-builders-prescan builders: - lf-infra-pre-build + - lf-update-java-alternatives: + java-version: "{sonarcloud-java-version}" - lf-infra-sonar-with-prescan: sonar-task: "{sonar-task}" sonar-project-file: "{sonar-project-file}" @@ -2241,6 +2246,8 @@ name: lf-sonar-builders-prescan-script builders: - lf-infra-pre-build + - lf-update-java-alternatives: + java-version: "{sonarcloud-java-version}" - shell: "{sonar-prescan-script}" - lf-infra-sonar: sonar-task: "{sonar-task}" diff --git a/releasenotes/notes/set-sonar-java-45f348f714f79c40.yaml b/releasenotes/notes/set-sonar-java-45f348f714f79c40.yaml new file mode 100644 index 00000000..60082f7e --- /dev/null +++ b/releasenotes/notes/set-sonar-java-45f348f714f79c40.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Add ``sonarcloud-java-version`` parameter to LF Sonar builders, which allows + setting the JDK version to use with the Sonar scanner (default: openjdk11). -- 2.16.6