Skip to content

Commit

Permalink
Use package version for publish-release, auto matically switch to JAV…
Browse files Browse the repository at this point in the history
…A_7_HOME if its available
  • Loading branch information
holdenk committed Sep 20, 2017
1 parent ebeab00 commit aa4cbf6
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions dev/create-release/release-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Top level targets are
All other inputs are environment variables
GIT_REF - Release tag or commit to build from
SPARK_VERSION - Release identifier used when publishing
SPARK_PACKAGE_VERSION - Release identifier in top level package directory
SPARK_VERSION - Version of Spark being built (e.g. 2.1.2)
SPARK_PACKAGE_VERSION - Release identifier in top level package directory (e.g. 2.1.2-rc1)
REMOTE_PARENT_DIR - Parent in which to create doc or release builds.
REMOTE_PARENT_MAX_LENGTH - If set, parent directory will be cleaned to only
have this number of subdirectories (by deleting old ones). WARNING: This deletes data.
Expand Down Expand Up @@ -98,20 +98,25 @@ fi
# Verify we have the right java version set
java_version=$("${JAVA_HOME}"/bin/javac -version 2>&1 | cut -d " " -f 2)

if [[ ! $SPARK_VERSION < "v2.2" ]]; then
if [[ ! $SPARK_VERSION < "2.2." ]]; then
if [[ $java_version < "1.8." ]]; then
echo "Java version $java_version is less than required 1.8 for 2.2+"
echo "Please set JAVA_HOME correctly."
exit 1
fi
else
if [[ $java_version > "1.7." ]]; then
echo "Java version $java_version is higher than required 1.7 for pre-2.2"
echo "Please set JAVA_HOME correctly."
exit 1
if [ -z "$JAVA_7_HOME" ]; then
echo "Java version $java_version is higher than required 1.7 for pre-2.2"
echo "Please set JAVA_HOME correctly."
exit 1
else
JAVA_HOME="$JAVA_7_HOME"
fi
fi
fi


if [ -z "$SPARK_PACKAGE_VERSION" ]; then
SPARK_PACKAGE_VERSION="${SPARK_VERSION}-$(date +%Y_%m_%d_%H_%M)-${git_hash}"
fi
Expand Down Expand Up @@ -301,11 +306,6 @@ if [[ "$1" == "docs" ]]; then
fi

if [[ "$1" == "publish-snapshot" ]]; then
# Drop the v from the start of the version string for nexus.
# shellcheck disable=SC2001
VERSION_WITH_RC=$(echo "$RELEASE_TAG" | sed -e "s/v//")
SPARK_VERSION=$VERSION_WITH_RC

cd spark
# Publish Spark to Maven release repo
echo "Deploying Spark SNAPSHOT at '$GIT_REF' ($git_hash)"
Expand Down Expand Up @@ -340,10 +340,7 @@ if [[ "$1" == "publish-snapshot" ]]; then
fi

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

cd spark
# Publish Spark to Maven release repo
Expand Down

0 comments on commit aa4cbf6

Please sign in to comment.