From: Jessica Wagantall Date: Fri, 5 Jul 2019 19:26:17 +0000 (-0700) Subject: Configure mvn-goals in maven-sonar.sh X-Git-Tag: v0.40.0~24 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=2f674071c16e88158c78d1d8472c3f89821a9f2f;p=releng%2Fglobal-jjb.git Configure mvn-goals in maven-sonar.sh Extend maven-sonar.sh to allow configuration of maven goals for the build step. Set to default as "clean install". This change will not cause any issue for projects already using this job. Issue: RELENG-2184 Change-Id: Ic8fe16de24097ec9ef805a24de4cebaef934fb04 Signed-off-by: Jessica Wagantall --- diff --git a/docs/jjb/lf-maven-jobs.rst b/docs/jjb/lf-maven-jobs.rst index 85bebcc7..ad59153a 100644 --- a/docs/jjb/lf-maven-jobs.rst +++ b/docs/jjb/lf-maven-jobs.rst @@ -466,6 +466,8 @@ interest in that kind of support. :java-version: Version of Java to use for the build. (default: openjdk8) :mvn-global-settings: The name of the Maven global settings to use for Maven configuration. (default: global-settings) + :mvn-goals: The maven goals to perform for the build. + (default: clean install) :mvn-opts: Sets MAVEN_OPTS. (default: '') :mvn-params: Additional mvn parameters to pass to the cli. (default: '') :mvn-version: Version of maven to use. (default: mvn35) diff --git a/jjb/lf-maven-jobs.yaml b/jjb/lf-maven-jobs.yaml index f8982c06..e42dcdef 100644 --- a/jjb/lf-maven-jobs.yaml +++ b/jjb/lf-maven-jobs.yaml @@ -1106,6 +1106,7 @@ github-url: 'https://github.com' java-version: openjdk8 mvn-global-settings: global-settings + mvn-goals: clean install mvn-opts: '' mvn-params: '' mvn-version: mvn35 @@ -1177,6 +1178,7 @@ - shell: echo 'Using SonarCloud' - lf-infra-maven-sonarcloud: java-version: '{java-version}' + mvn-goals: '{mvn-goals}' mvn-settings: '{mvn-settings}' mvn-version: '{mvn-version}' sonarcloud-project-key: '{sonarcloud-project-key}' @@ -1192,6 +1194,7 @@ - shell: echo 'Using SonarQube' - lf-infra-maven-sonar: java-version: '{java-version}' + mvn-goals: '{mvn-goals}' mvn-settings: '{mvn-settings}' mvn-version: '{mvn-version}' @@ -1210,7 +1213,9 @@ java-version: '{java-version}' - inject: # Switch this to the sonar wrapper when JJB 2.0 is available - properties-content: SONAR_HOST_URL=$SONAR_URL + properties-content: | + SONAR_HOST_URL=$SONAR_URL + MAVEN_GOALS={mvn-goals} - lf-provide-maven-settings: global-settings-file: global-settings settings-file: '{mvn-settings}' @@ -1233,6 +1238,7 @@ SONAR_HOST_URL=https://sonarcloud.io PROJECT_KEY={sonarcloud-project-key} PROJECT_ORGANIZATION={sonarcloud-project-organization} + MAVEN_GOALS={mvn-goals} API_TOKEN={sonarcloud-api-token} - lf-provide-maven-settings: global-settings-file: global-settings diff --git a/releasenotes/notes/configure-maven-sonar-goals-1b0018c932b2f9a1.yaml b/releasenotes/notes/configure-maven-sonar-goals-1b0018c932b2f9a1.yaml new file mode 100644 index 00000000..642e3559 --- /dev/null +++ b/releasenotes/notes/configure-maven-sonar-goals-1b0018c932b2f9a1.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Allow maven goals to be configured in maven-sonar.sh. + Set to "clean install" by default. diff --git a/shell/maven-sonar.sh b/shell/maven-sonar.sh index 706697b1..e78d156f 100644 --- a/shell/maven-sonar.sh +++ b/shell/maven-sonar.sh @@ -25,7 +25,7 @@ params+=("--settings $SETTINGS_FILE") # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters. # shellcheck disable=SC2086 -$MVN clean install \ +$MVN $MAVEN_GOALS \ -e -Dsonar \ ${params[*]} \ $MAVEN_OPTIONS $MAVEN_PARAMS