From 37c15b249d0b9e6184cf453df03611fd1a4ef045 Mon Sep 17 00:00:00 2001 From: Dianjin Wang Date: Mon, 12 Oct 2026 18:03:54 +0800 Subject: [PATCH] Release: check the pom.xml version against the release tag The release script checked the VERSION file against the tag but never compared it with the in pom.xml, which ships in the source tarball. The go-libs and pxf 2.2.0-incubating-rc2 tarballs went out with pom.xml still at 2.1.0-incubating because their scripts had the same gap; this one was right only because pom.xml had been bumped by hand. Read the project version with xmllint, which the script already requires, and stop unless it is -incubating. Assisted-by: Claude Code --- cloudberry-backup-release.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cloudberry-backup-release.sh b/cloudberry-backup-release.sh index 6cf277b9..42fc0ff9 100755 --- a/cloudberry-backup-release.sh +++ b/cloudberry-backup-release.sh @@ -25,7 +25,7 @@ # tarball assembly. # # Supported Features: -# - Validates version consistency between release tag and VERSION file +# - Validates version consistency between release tag, VERSION file and pom.xml # - Supports both final releases and release candidates (e.g., 2.0.0-incubating, 2.0.0-incubating-rc1) # - Optionally reuses existing annotated Git tags if they match the current HEAD # - Verifies that Git submodules are initialized (if defined in .gitmodules) @@ -399,6 +399,20 @@ if [[ "$VERSION_FILE" != "$BASE_VERSION" ]]; then exit 1 fi +# The Maven project version in pom.xml is used by the Apache RAT check and +# ships in the source tarball, so it must match the release version. +POM_VERSION=$(xmllint --xpath '//*[local-name()="project"]/*[local-name()="version"]/text()' pom.xml 2>/dev/null || true) +if [[ -z "$POM_VERSION" ]]; then + echo "ERROR: Could not extract from pom.xml" + exit 1 +fi + +if [[ "$POM_VERSION" != "${BASE_VERSION}-incubating" ]]; then + echo "ERROR: Version in pom.xml ($POM_VERSION) does not match ${BASE_VERSION}-incubating." + echo "For RC tags like '$TAG', pom.xml should contain '${BASE_VERSION}-incubating'." + exit 1 +fi + # Ensure working tree is clean if ! git diff-index --quiet HEAD --; then @@ -410,6 +424,7 @@ echo "Version consistency verified" printf " %-14s: %s\n" "Release Tag" "$TAG" printf " %-14s: %s\n" "Base Version" "$BASE_VERSION" printf " %-14s: %s\n" "VERSION file" "$VERSION_FILE" +printf " %-14s: %s\n" "pom.xml" "$POM_VERSION" confirm_next_step section "Checking the state of the Tag"