From ae3d96d6534ffc1e1de2e07ff9a4689bec11a90d Mon Sep 17 00:00:00 2001 From: Jessica Wagantall Date: Mon, 22 Apr 2019 14:42:08 -0700 Subject: [PATCH 1/1] Make stripping of "SNAPSHOT" in poms optional 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 --- jjb/lf-maven-jobs.yaml | 6 +++++- .../notes/patch-release-strip-optional-89d49b3b3bf1c511.yaml | 7 +++++++ shell/maven-patch-release.sh | 8 ++++---- 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/patch-release-strip-optional-89d49b3b3bf1c511.yaml diff --git a/jjb/lf-maven-jobs.yaml b/jjb/lf-maven-jobs.yaml index dea836b2..4342a8f6 100644 --- a/jjb/lf-maven-jobs.yaml +++ b/jjb/lf-maven-jobs.yaml @@ -727,6 +727,10 @@ 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}' @@ -746,13 +750,13 @@ - 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 index 00000000..76358025 --- /dev/null +++ b/releasenotes/notes/patch-release-strip-optional-89d49b3b3bf1c511.yaml @@ -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. diff --git a/shell/maven-patch-release.sh b/shell/maven-patch-release.sh index d6e90805..4f49b4f5 100644 --- a/shell/maven-patch-release.sh +++ b/shell/maven-patch-release.sh @@ -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" -- 2.16.6