From 5e251c49d01a45c177d17bac7ee4e923d2bd2df7 Mon Sep 17 00:00:00 2001 From: Nick Dimiduk Date: Tue, 25 Oct 2022 18:18:26 +0200 Subject: [PATCH] HBASE-27442 Change the way of bumping version in release scripts Signed-off-by: Duo Zhang --- dev-support/create-release/release-util.sh | 34 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/dev-support/create-release/release-util.sh b/dev-support/create-release/release-util.sh index 6241a8538a08..fdb078810cef 100755 --- a/dev-support/create-release/release-util.sh +++ b/dev-support/create-release/release-util.sh @@ -685,8 +685,38 @@ function kick_gpg_agent { # Do maven command to set version into local pom function maven_set_version { #input: local this_version="$1" - log "${MVN[@]}" versions:set -DnewVersion="$this_version" - "${MVN[@]}" versions:set -DnewVersion="$this_version" | grep -v "no value" # silence logs + local use_revision='false' + local -a version_splits=() + IFS='.' read -ar version_splits <<< "$(maven_get_version)" + + # Do the right thing based on project and release line. + if [ "${PROJECT}" = 'hbase' ] ; then + if [ "${version_splits[0]}" -le 1 ] ; then + use_revision='false' + elif [ "${version_splits[0]}" -eq 2 ] && [ "${version_splits[1]}" -le 4 ] ; then + use_revision='false' + elif [ "${version_splits[0]}" -eq 2 ] && [ "${version_splits[1]}" -ge 5 ] ; then + use_revision='true' + elif [ "${version_splits[0]}" -ge 3 ] ; then + use_revision='true' + fi + elif [ "${PROJECT}" = 'hbase-thirdparty' ] ; then + use_revision='false' + elif [ "${PROJECT}" = 'hbase-connectors' ] ; then + use_revision='true' + elif [ "${PROJECT}" = 'hbase-filesystem' ] ; then + use_revision='false' + elif [ "${PROJECT}" = 'hbase-operator-tools' ] ; then + use_revision='false' + fi + + if [ "${use_revision}" = 'false' ] ; then + log "${MVN[@]}" versions:set -DnewVersion="$this_version" + "${MVN[@]}" versions:set -DnewVersion="$this_version" | grep -v "no value" # silence logs + else + log "${MVN[@]}" versions:set-property -Dproperty=revision -DnewVersion="$this_version" -DgenerateBackupPoms=false + "${MVN[@]}" versions:set-property -Dproperty=revision -DnewVersion="$this_version" -DgenerateBackupPoms=false | grep -v "no value" # silence logs + fi } # Do maven command to read version from local pom