From e4fa7184a1de0edb1b482d5b911cfad0d2fffb32 Mon Sep 17 00:00:00 2001 From: Shreyesh Arangath Date: Mon, 10 Aug 2026 05:07:58 +0000 Subject: [PATCH] [AURON #2459] Resolve build info paths relative to auron-build.sh auron-build.sh resolved both the build info file and the Maven used to look up project.version relative to the caller's working directory. Run from anywhere other than the project root it wrote auron-build-info.properties outside the project, so the build never picked it up, and project.version was dropped from the file because the lookup failed into /dev/null and empty values are skipped. Resolve SCRIPT_DIR from BASH_SOURCE and use it for the build info file, reuse the already resolved MVN_CMD instead of a hardcoded ./build/mvn, and pass -f so Maven reads the project pom rather than falling back to its standalone pom, which reports version 1. Fail with the captured Maven output when the version cannot be resolved, rather than shipping a jar with no version in it. --- auron-build.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/auron-build.sh b/auron-build.sh index 2fffcabf5..1a5722a75 100755 --- a/auron-build.sh +++ b/auron-build.sh @@ -150,7 +150,8 @@ run_docker_compose_up() { exit 1 } -MVN_CMD="$(dirname "$0")/build/mvn" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +MVN_CMD="$SCRIPT_DIR/build/mvn" # ----------------------------------------------------------------------------- # Section: Initialize Variables @@ -523,11 +524,20 @@ MVN_ARGS=("${CLEAN_ARGS[@]}" "${BUILD_ARGS[@]}") # Description: # Generate auron-build-info.properties for build metadata tracking. # ----------------------------------------------------------------------------- -BUILD_INFO_FILE="common/src/main/resources/auron-build-info.properties" +BUILD_INFO_FILE="$SCRIPT_DIR/common/src/main/resources/auron-build-info.properties" mkdir -p "$(dirname "$BUILD_INFO_FILE")" JAVA_VERSION=$(java -version 2>&1 | head -n 1 | awk '{print $3}' | tr -d '"') -PROJECT_VERSION=$(./build/mvn help:evaluate -N -Dexpression=project.version -Pspark-${SPARK_VER} -q -DforceStdout 2>/dev/null) +MVN_STDERR=$(mktemp) +if ! PROJECT_VERSION=$("$MVN_CMD" help:evaluate -N -f "$SCRIPT_DIR/pom.xml" -Dexpression=project.version -Pspark-${SPARK_VER} -q -DforceStdout 2>"$MVN_STDERR") \ + || [[ ! "$PROJECT_VERSION" =~ ^[A-Za-z0-9._-]+$ ]]; then + echo "[ERROR] Failed to resolve project.version using $MVN_CMD" >&2 + [[ -n "$PROJECT_VERSION" ]] && echo "[ERROR] stdout was: $PROJECT_VERSION" >&2 + sed 's/^/[ERROR] /' "$MVN_STDERR" >&2 + rm -f "$MVN_STDERR" + exit 1 +fi +rm -f "$MVN_STDERR" RUST_VERSION=$(rustc --version | awk '{print $2}') get_build_info() {