From b6b667a0298f0ed993b04f72d35d49c3a7187909 Mon Sep 17 00:00:00 2001 From: Duo Zhang Date: Sun, 21 Apr 2024 19:40:07 +0800 Subject: [PATCH] HASE-28414 create-release should spotless:apply after making any file changes (#5824) Signed-off-by: Bryan Beaudreault --- dev-support/create-release/release-build.sh | 6 ++++-- dev-support/create-release/release-util.sh | 11 +++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/dev-support/create-release/release-build.sh b/dev-support/create-release/release-build.sh index f3d8798be462..6cc855c97259 100755 --- a/dev-support/create-release/release-build.sh +++ b/dev-support/create-release/release-build.sh @@ -146,7 +146,8 @@ if [[ "$1" == "tag" ]]; then # Create release version maven_set_version "$RELEASE_VERSION" - find . -name pom.xml -exec git add {} \; + maven_spotless_apply + git_add_poms # Always put CHANGES.md and RELEASENOTES.md to parent directory, so later we do not need to # check their position when generating release data. We can not put them under the source code # directory because for 3.x+, CHANGES.md and RELEASENOTES.md are not tracked so later when @@ -168,7 +169,8 @@ if [[ "$1" == "tag" ]]; then # Create next version maven_set_version "$NEXT_VERSION" - find . -name pom.xml -exec git add {} \; + maven_spotless_apply + git_add_poms git commit -s -m "Preparing development version $NEXT_VERSION" if ! is_dry_run; then diff --git a/dev-support/create-release/release-util.sh b/dev-support/create-release/release-util.sh index 3a1b38644f85..a33319fd3614 100755 --- a/dev-support/create-release/release-util.sh +++ b/dev-support/create-release/release-util.sh @@ -871,3 +871,14 @@ function get_hadoop3_version() { echo "${version}-hadoop3" fi } + +# Run mvn spotless:apply to format the code base +# For 2.x, the generated CHANGES.md and RELEASENOTES.md may have lines end with whitespace and +# case spotless:check failure, so we should run spotless:apply before committing +function maven_spotless_apply() { + "${MVN[@]}" spotless:apply +} + +function git_add_poms() { + find . -name pom.xml -exec git add {} \; +}