From bf2c57751c5ddf5004b74bb2b575d4751435a6f5 Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Thu, 5 Mar 2020 11:31:42 -0500 Subject: [PATCH] Patch new Cmake/Tox + SonarQube templates Revise templates gerrit-cmake-sonarqube and gerrit-tox-sonarqube to move the triggering comment string into a parameter that can be overridden in a job definition. Github comment remains hardcoded. This makes these new templates consistent with existing templates. No functional change, the default is still "run-sonar". Rename gerrit-cmake-sonarqube tempplate configuration parameter from sonar-prescan-script to pre-build to be consistent with existing CMake stage and verify templates. This is a breaking change for any early adopters of this new template. Correct release note file name prefix from cmake to tox Change-Id: Ie98a58d2bf8cbffee110571df5d759c101cc3fc7 Issue-ID: RELENG-2760 Signed-off-by: Lott, Christopher (cl778h) --- docs/jjb/lf-c-cpp-jobs.rst | 4 ++-- jjb/lf-c-cpp-jobs.yaml | 16 +++++++++++----- jjb/lf-python-jobs.yaml | 12 +++++++++--- .../notes/sonarqube-triggers-38a79489ecb6b4f3.yaml | 12 ++++++++++++ ...1775987.yaml => tox-sonarqube-4cb43bea721775987.yaml} | 0 5 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 releasenotes/notes/sonarqube-triggers-38a79489ecb6b4f3.yaml rename releasenotes/notes/{cmake-sonarqube-4cb43bea721775987.yaml => tox-sonarqube-4cb43bea721775987.yaml} (100%) diff --git a/docs/jjb/lf-c-cpp-jobs.rst b/docs/jjb/lf-c-cpp-jobs.rst index 362d7146..4ced0940 100644 --- a/docs/jjb/lf-c-cpp-jobs.rst +++ b/docs/jjb/lf-c-cpp-jobs.rst @@ -120,11 +120,11 @@ Plug-in configurations :install-prefix: CMAKE_INSTALL_PREFIX to use for install. (default: $BUILD_DIR/output) :make-opts: Parameters to pass to make. (default: '') + :pre-build: Shell script to run before performing build. Useful for + setting up dependencies. (default: '') :sonar-additional-args: Command line arguments. (default: '') :sonar-java-opts: JVM options. For example, use option -Xmx to increase the memory size limit. (default: '') - :sonar-prescan-script: A shell script to run before the build and scan. - Useful for setting up dependencies. (default: '') :sonar-project-file: The file name with Sonar configuration properties (default: sonar-project.properties) :sonar-properties: Sonar configuration properties. (default: '') diff --git a/jjb/lf-c-cpp-jobs.yaml b/jjb/lf-c-cpp-jobs.yaml index fa4e35b0..6f4db494 100644 --- a/jjb/lf-c-cpp-jobs.yaml +++ b/jjb/lf-c-cpp-jobs.yaml @@ -159,6 +159,7 @@ github-url: "https://github.com" install-prefix: "$BUILD_DIR/output" make-opts: "" + pre-build: "" stream: master submodule-recursive: true submodule-timeout: 10 @@ -167,7 +168,6 @@ # Sonar properties sonar-additional-args: "" sonar-java-opts: "" - sonar-prescan-script: "" sonar-project-file: "sonar-project.properties" sonar-properties: "" sonar-task: "" @@ -210,7 +210,7 @@ builders: - lf-infra-pre-build - - shell: "{sonar-prescan-script}" + - shell: "{pre-build}" - shell: !include-raw-escape: ../shell/cmake-sonarqube.sh - lf-infra-sonar: sonar-task: "{sonar-task}" @@ -228,6 +228,14 @@ concurrent: false <<: *lf_cmake_sonarqube + ###################### + # Default parameters # + ###################### + + gerrit_sonar_triggers: + - comment-added-contains-event: + comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$' + scm: - lf-infra-gerrit-scm: branch: "$GERRIT_BRANCH" @@ -243,9 +251,7 @@ - timed: "{obj:cron}" - gerrit: server-name: "{gerrit-server-name}" - trigger-on: - - comment-added-contains-event: - comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$' + trigger-on: "{obj:gerrit_sonar_triggers}" projects: - project-compare-type: "ANT" project-pattern: "{project}" diff --git a/jjb/lf-python-jobs.yaml b/jjb/lf-python-jobs.yaml index 59ae5494..9f91a6f7 100644 --- a/jjb/lf-python-jobs.yaml +++ b/jjb/lf-python-jobs.yaml @@ -507,6 +507,14 @@ concurrent: false <<: *lf_tox_sonarqube + ###################### + # Default parameters # + ###################### + + gerrit_sonar_triggers: + - comment-added-contains-event: + comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$' + scm: - lf-infra-gerrit-scm: branch: "$GERRIT_BRANCH" @@ -522,9 +530,7 @@ - timed: "{obj:cron}" - gerrit: server-name: "{gerrit-server-name}" - trigger-on: - - comment-added-contains-event: - comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$' + trigger-on: "{obj:gerrit_sonar_triggers}" projects: - project-compare-type: "ANT" project-pattern: "{project}" diff --git a/releasenotes/notes/sonarqube-triggers-38a79489ecb6b4f3.yaml b/releasenotes/notes/sonarqube-triggers-38a79489ecb6b4f3.yaml new file mode 100644 index 00000000..1a5663e3 --- /dev/null +++ b/releasenotes/notes/sonarqube-triggers-38a79489ecb6b4f3.yaml @@ -0,0 +1,12 @@ +--- +fixes: + - | + Revise templates gerrit-cmake-sonarqube and gerrit-tox-sonarqube + to move the triggering comment string into a parameter that can be + overridden in a job definition. Github comment remains hardcoded. + The default is still "run-sonar". + + Rename gerrit-cmake-sonarqube tempplate configuration parameter + from sonar-prescan-script to pre-build to be consistent with + existing CMake stage and verify templates. This is a breaking + change for any early adopters of this new template. diff --git a/releasenotes/notes/cmake-sonarqube-4cb43bea721775987.yaml b/releasenotes/notes/tox-sonarqube-4cb43bea721775987.yaml similarity index 100% rename from releasenotes/notes/cmake-sonarqube-4cb43bea721775987.yaml rename to releasenotes/notes/tox-sonarqube-4cb43bea721775987.yaml -- 2.16.6