From: Thanh Ha Date: Thu, 28 Dec 2017 01:48:36 +0000 (-0500) Subject: Allow SONAR_MAVEN_GOAL to be configurable X-Git-Tag: v0.14.0~8^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=5ffdf16ad97cb83038320301062221c990f283c8;p=releng%2Fglobal-jjb.git Allow SONAR_MAVEN_GOAL to be configurable Per reports on the mailing list Sonar jobs are broken in OpenDaylight. This is because Sonar release a new plugin which only works with newer versions of Sonar so until we can upgrade we need to allow flexibility to configure the Sonar job to override the default sonar:sonar goal. With this patch it is now possible to override the Sonar goal in JJB and force an older version of the Sonar plugin to run using a JJB defaults config or projects variable like this: sonar-mvn-goal: org.codehaus.mojo:sonar-maven-plugin:3.3.0.603:sonar Unfortunately due to the defaults priority of JJB since we are defining the sonar-mvn-goal parameter inside of the job template it can only be overrided via a project section. Reports: https://lists.opendaylight.org/pipermail/release/2017-December/013119.html https://lists.opendaylight.org/pipermail/release/2017-December/013223.html Change-Id: I04512613f39e7c328e0f2f18d9c4729667e86909 Signed-off-by: Thanh Ha --- diff --git a/.jjb-test/expected-xml/gerrit-maven-sonar b/.jjb-test/expected-xml/gerrit-maven-sonar index 6e038933..cf178aa4 100644 --- a/.jjb-test/expected-xml/gerrit-maven-sonar +++ b/.jjb-test/expected-xml/gerrit-maven-sonar @@ -100,13 +100,21 @@ For example '<1.0.0' or '>=1.0.0,<2.0.0'. STAGING_PROFILE_ID Nexus staging profile ID. - uuddlrlrba + ARCHIVE_ARTIFACTS Artifacts to archive to the logs server. + + SONAR_MAVEN_GOAL + Maven goals to pass to the Sonar call. Typically sonar:sonar +however to use a specific version of the sonar-maven-plugin we +can call "org.codehaus.mojo:sonar-maven-plugin:3.3.0.603:sonar". + + sonar:sonar + @@ -220,9 +228,7 @@ For example '<1.0.0' or '>=1.0.0,<2.0.0'. - SONAR_HOST_URL=$SONAR_URL -SONAR_MAVEN_GOAL=sonar:sonar - + SONAR_HOST_URL=$SONAR_URL diff --git a/.jjb-test/expected-xml/github-maven-sonar b/.jjb-test/expected-xml/github-maven-sonar index 710c2ec8..dac8f70d 100644 --- a/.jjb-test/expected-xml/github-maven-sonar +++ b/.jjb-test/expected-xml/github-maven-sonar @@ -95,13 +95,21 @@ For example '<1.0.0' or '>=1.0.0,<2.0.0'. STAGING_PROFILE_ID Nexus staging profile ID. - uuddlrlrba + ARCHIVE_ARTIFACTS Artifacts to archive to the logs server. + + SONAR_MAVEN_GOAL + Maven goals to pass to the Sonar call. Typically sonar:sonar +however to use a specific version of the sonar-maven-plugin we +can call "org.codehaus.mojo:sonar-maven-plugin:3.3.0.603:sonar". + + sonar:sonar + @@ -185,9 +193,7 @@ For example '<1.0.0' or '>=1.0.0,<2.0.0'. - SONAR_HOST_URL=$SONAR_URL -SONAR_MAVEN_GOAL=sonar:sonar - + SONAR_HOST_URL=$SONAR_URL diff --git a/jjb/lf-maven-jobs.yaml b/jjb/lf-maven-jobs.yaml index 6d756669..8d4d837b 100644 --- a/jjb/lf-maven-jobs.yaml +++ b/jjb/lf-maven-jobs.yaml @@ -662,6 +662,7 @@ mvn-opts: '' mvn-params: '' mvn-version: mvn33 + sonar-mvn-goal: 'sonar:sonar' staging-profile-id: '' # Unused in this job stream: master submodule-recursive: true @@ -674,6 +675,30 @@ # Job Configuration # ##################### + parameters: + - lf-infra-parameters: + project: '{project}' + branch: '{branch}' + stream: '{stream}' + lftools-version: '{lftools-version}' + - lf-infra-maven-parameters: + mvn-opts: '{mvn-opts}' + mvn-params: '{mvn-params}' + mvn-version: '{mvn-version}' + # Staging repos do not make sense for Sonar jobs so set it blank. + staging-profile-id: '' + - string: + name: ARCHIVE_ARTIFACTS + default: '{archive-artifacts}' + description: Artifacts to archive to the logs server. + - string: + name: SONAR_MAVEN_GOAL + default: '{sonar-mvn-goal}' + description: | + Maven goals to pass to the Sonar call. Typically sonar:sonar + however to use a specific version of the sonar-maven-plugin we + can call "org.codehaus.mojo:sonar-maven-plugin:3.3.0.603:sonar". + triggers: - timed: 'H H * * 6' - gerrit: @@ -709,9 +734,7 @@ mvn-version: '{mvn-version}' - inject: # Switch this to the sonar wrapper when JJB 2.0 is available - properties-content: | - SONAR_HOST_URL=$SONAR_URL - SONAR_MAVEN_GOAL=sonar:sonar + properties-content: SONAR_HOST_URL=$SONAR_URL - lf-provide-maven-settings: global-settings-file: global-settings settings-file: '{mvn-settings}'