Skip to content

Commit aa4cbf6

Browse files
committed
Use package version for publish-release, auto matically switch to JAVA_7_HOME if its available
1 parent ebeab00 commit aa4cbf6

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

dev/create-release/release-build.sh

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ Top level targets are
3131
All other inputs are environment variables
3232
3333
GIT_REF - Release tag or commit to build from
34-
SPARK_VERSION - Release identifier used when publishing
35-
SPARK_PACKAGE_VERSION - Release identifier in top level package directory
34+
SPARK_VERSION - Version of Spark being built (e.g. 2.1.2)
35+
SPARK_PACKAGE_VERSION - Release identifier in top level package directory (e.g. 2.1.2-rc1)
3636
REMOTE_PARENT_DIR - Parent in which to create doc or release builds.
3737
REMOTE_PARENT_MAX_LENGTH - If set, parent directory will be cleaned to only
3838
have this number of subdirectories (by deleting old ones). WARNING: This deletes data.
@@ -98,20 +98,25 @@ fi
9898
# Verify we have the right java version set
9999
java_version=$("${JAVA_HOME}"/bin/javac -version 2>&1 | cut -d " " -f 2)
100100

101-
if [[ ! $SPARK_VERSION < "v2.2" ]]; then
101+
if [[ ! $SPARK_VERSION < "2.2." ]]; then
102102
if [[ $java_version < "1.8." ]]; then
103103
echo "Java version $java_version is less than required 1.8 for 2.2+"
104104
echo "Please set JAVA_HOME correctly."
105105
exit 1
106106
fi
107107
else
108108
if [[ $java_version > "1.7." ]]; then
109-
echo "Java version $java_version is higher than required 1.7 for pre-2.2"
110-
echo "Please set JAVA_HOME correctly."
111-
exit 1
109+
if [ -z "$JAVA_7_HOME" ]; then
110+
echo "Java version $java_version is higher than required 1.7 for pre-2.2"
111+
echo "Please set JAVA_HOME correctly."
112+
exit 1
113+
else
114+
JAVA_HOME="$JAVA_7_HOME"
115+
fi
112116
fi
113117
fi
114118

119+
115120
if [ -z "$SPARK_PACKAGE_VERSION" ]; then
116121
SPARK_PACKAGE_VERSION="${SPARK_VERSION}-$(date +%Y_%m_%d_%H_%M)-${git_hash}"
117122
fi
@@ -301,11 +306,6 @@ if [[ "$1" == "docs" ]]; then
301306
fi
302307

303308
if [[ "$1" == "publish-snapshot" ]]; then
304-
# Drop the v from the start of the version string for nexus.
305-
# shellcheck disable=SC2001
306-
VERSION_WITH_RC=$(echo "$RELEASE_TAG" | sed -e "s/v//")
307-
SPARK_VERSION=$VERSION_WITH_RC
308-
309309
cd spark
310310
# Publish Spark to Maven release repo
311311
echo "Deploying Spark SNAPSHOT at '$GIT_REF' ($git_hash)"
@@ -340,10 +340,7 @@ if [[ "$1" == "publish-snapshot" ]]; then
340340
fi
341341

342342
if [[ "$1" == "publish-release" ]]; then
343-
# Drop the v from the start of the version string for nexus.
344-
# shellcheck disable=SC2001
345-
VERSION_WITH_RC=$(echo "$RELEASE_TAG" | sed -e "s/v//")
346-
SPARK_VERSION=$VERSION_WITH_RC
343+
SPARK_VERSION=$SPARK_PACKAGE_VERSION
347344

348345
cd spark
349346
# Publish Spark to Maven release repo

0 commit comments

Comments
 (0)