From: Jessica Wagantall Date: Wed, 27 Apr 2022 19:09:12 +0000 (-0700) Subject: Fix: Add maven pre and post build scripts X-Git-Tag: v0.76.4^0 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=ff3ea7c20d4ea68079502f20efa885b298bc6cb2;p=releng%2Fglobal-jjb.git Fix: Add maven pre and post build scripts Optionally run a script before and/or after maven goals. This will help add dependencies and post process builds with more flexibility to the project's needs. Issue: IT-23957 Signed-off-by: Jessica Wagantall Change-Id: I7075972c796a2cac17d9ad7ec9e99be1699354c3 --- diff --git a/docs/jjb/lf-maven-jobs.rst b/docs/jjb/lf-maven-jobs.rst index 59b50182..c3ab35b3 100644 --- a/docs/jjb/lf-maven-jobs.rst +++ b/docs/jjb/lf-maven-jobs.rst @@ -322,6 +322,8 @@ This job uses the following strategy to deploy jobs to Nexus: :mvn-params: Parameters to pass to the mvn CLI. (default: '') :mvn-version: Version of maven to use. (default: mvn35) :nexus-cut-dirs: Number of directories to cut from file path for `wget -r`. + :pre-build-script: Shell script to run before maven build. (default: a string with a shell comment) + :post-build-script: Shell script to run after maven build. (default: a string with a shell comment) :stream: Keyword that represents a release code-name. Often the same as the branch. (default: master) :submodule-recursive: Whether to checkout submodules recursively. @@ -578,6 +580,8 @@ This job runs on dev branches and its triggered on new patchsets. :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '') :mvn-params: Parameters to pass to the mvn CLI. (default: '') :mvn-version: Version of maven to use. (default: mvn35) + :pre-build-script: Shell script to run before maven build. (default: a string with a shell comment) + :post-build-script: Shell script to run after maven build. (default: a string with a shell comment) :sonar-mvn-goal: Maven goals to run for sonar analysis. (default: sonar:sonar) :sonarcloud: Set to ``true`` to use SonarCloud ``true|false``. diff --git a/jjb/lf-maven-jobs.yaml b/jjb/lf-maven-jobs.yaml index 878840cf..d8a1b5e3 100644 --- a/jjb/lf-maven-jobs.yaml +++ b/jjb/lf-maven-jobs.yaml @@ -574,6 +574,8 @@ mvn-params: "-Dmerge" mvn-version: mvn35 nexus-cut-dirs: 6 # Number of dirs in the Nexus path to remove for wget -r. + pre-build-script: "# pre-build script goes here" + post-build-script: "# post-build script goes here" stream: master submodule-recursive: true submodule-timeout: 10 @@ -617,8 +619,10 @@ NEXUS_CUT_DIRS={nexus-cut-dirs} NEXUS_REPO={nexus-snapshot-repo} - shell: !include-raw-escape: ../shell/maven-fetch-metadata.sh + - shell: "{pre-build-script}" - lf-maven-build: mvn-goals: "{mvn-goals}" + - shell: "{post-build-script}" - lf-maven-deploy - lf-provide-maven-settings-cleanup @@ -1543,6 +1547,8 @@ mvn-opts: "" mvn-params: "-Dstream=$STREAM -Dmaven.source.skip=true" mvn-version: mvn35 + pre-build-script: "# pre-build script goes here" + post-build-script: "# post-build script goes here" stream: master submodule-recursive: true submodule-timeout: 10 @@ -1582,8 +1588,10 @@ - lf-provide-maven-settings: global-settings-file: "{mvn-global-settings}" settings-file: "{mvn-settings}" + - shell: "{pre-build-script}" - lf-maven-build: mvn-goals: "{mvn-goals}" + - shell: "{post-build-script}" - lf-provide-maven-settings-cleanup publishers: diff --git a/releasenotes/notes/maven-verify-merge-pre-post-scripts-cbf3636f20635316.yaml b/releasenotes/notes/maven-verify-merge-pre-post-scripts-cbf3636f20635316.yaml new file mode 100644 index 00000000..9b5a245f --- /dev/null +++ b/releasenotes/notes/maven-verify-merge-pre-post-scripts-cbf3636f20635316.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Optionally run a script before and/or after maven goals. + This will help add dependencies and post process builds with more + flexibility to the project's needs.