Make stripping of "SNAPSHOT" in poms optional 63/15363/4
authorJessica Wagantall <jwagantall@linuxfoundation.org>
Mon, 22 Apr 2019 21:42:08 +0000 (14:42 -0700)
committerJessica Wagantall <jwagantall@linuxfoundation.org>
Thu, 25 Apr 2019 17:21:33 +0000 (10:21 -0700)
When maven-versions-plugin is set to "true", the job will
use the versions plugin to update the versions in the pom.xml
files and will not need this step in maven-patch-release.sh to
happen.
This change DOES NOT affect current jobs which do not use the
maven versions plugin as this variable is set to false by default.
Update maven-versions-plugin variable in the parameters to be able
to parse the value in the scripts.

Change-Id: Ic25197012fd0f23a859159bb86369feb8a02b9c2
Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
jjb/lf-maven-jobs.yaml
releasenotes/notes/patch-release-strip-optional-89d49b3b3bf1c511.yaml [new file with mode: 0644]
shell/maven-patch-release.sh

index dea836b..4342a8f 100644 (file)
           mvn-params: '{mvn-params}'
           mvn-version: '{mvn-version}'
           staging-profile-id: '{staging-profile-id}'
+      - bool:
+          name: MAVEN_VERSIONS_PLUGIN
+          default: '{maven-versions-plugin}'
+          description: Use maven-versions-plugin to update pom versions.
       - string:
           name: ARCHIVE_ARTIFACTS
           default: '{archive-artifacts}'
       - lf-provide-maven-settings:
           global-settings-file: '{mvn-global-settings}'
           settings-file: '{mvn-settings}'
-      - shell: !include-raw-escape: ../shell/maven-patch-release.sh
       - lf-maven-versions-plugin:
           maven-versions-plugin: '{maven-versions-plugin}'
           mvn-version: '{mvn-version}'
           mvn-pom: '{mvn-pom}'
           maven-versions-plugin-set-version: '{maven-versions-plugin-set-version}'
           mvn-settings: '{mvn-settings}'
+      - shell: !include-raw-escape: ../shell/maven-patch-release.sh
       - lf-maven-build:
           mvn-goals: '{mvn-goals}'
       - lf-sigul-sign-dir:
diff --git a/releasenotes/notes/patch-release-strip-optional-89d49b3b3bf1c511.yaml b/releasenotes/notes/patch-release-strip-optional-89d49b3b3bf1c511.yaml
new file mode 100644 (file)
index 0000000..7635802
--- /dev/null
@@ -0,0 +1,7 @@
+---
+fixes:
+  - |
+    Projects using maven versions plugin let this plugin take care or
+    updating their versions in the pom.xml. When maven-versions-plugin
+    is set to "true", skip the stripping of SNAPSHOTS from the pom.xml
+    files. maven-versions-plugin is set to "false" by default.
index d6e9080..4f49b4f 100644 (file)
@@ -18,10 +18,10 @@ mkdir -p "$PATCH_DIR"
 set -eu -o pipefail
 
 echo "$PROJECT" "$(git rev-parse --verify HEAD)" | tee -a "$PATCH_DIR/taglist.log"
-
-# Strip -SNAPSHOT from version to prepare release.
-find . -name "*.xml" -print0 | xargs -0 sed -i 's/-SNAPSHOT//g'
-
+if [[ "${MAVEN_VERSIONS_PLUGIN}" == "false" ]] ; then
+    # Strip -SNAPSHOT from version to prepare release.
+    find . -name "*.xml" -print0 | xargs -0 sed -i 's/-SNAPSHOT//g'
+fi
 git commit -am "Release $PROJECT"
 git format-patch --stdout "origin/$GERRIT_BRANCH" > "$PATCH_DIR/${PROJECT//\//-}.patch"
 git bundle create "$PATCH_DIR/${PROJECT//\//-}.bundle" "origin/${GERRIT_BRANCH}..HEAD"