2014-02-09 02:13:34 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
#
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership.
|
|
|
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
# (the "License"); you may not use this file except in compliance with
|
|
|
|
# the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
|
|
|
|
# Quick-and-dirty automation of making maven and binary releases. Not robust at all.
|
|
|
|
# Publishes releases to Maven and packages/copies binary release artifacts.
|
|
|
|
# Expects to be run in a totally empty directory.
|
|
|
|
#
|
2014-04-28 16:58:42 -04:00
|
|
|
# Options:
|
2015-02-03 00:00:30 -05:00
|
|
|
# --skip-create-release Assume the desired release tag already exists
|
|
|
|
# --skip-publish Do not publish to Maven central
|
|
|
|
# --skip-package Do not package and upload binary artifacts
|
2014-02-09 02:13:34 -05:00
|
|
|
# Would be nice to add:
|
|
|
|
# - Send output to stderr and have useful logging in stdout
|
|
|
|
|
2014-11-11 21:02:59 -05:00
|
|
|
# Note: The following variables must be set before use!
|
2014-11-18 00:07:50 -05:00
|
|
|
ASF_USERNAME=${ASF_USERNAME:-pwendell}
|
|
|
|
ASF_PASSWORD=${ASF_PASSWORD:-XXX}
|
2014-04-28 16:58:42 -04:00
|
|
|
GPG_PASSPHRASE=${GPG_PASSPHRASE:-XXX}
|
|
|
|
GIT_BRANCH=${GIT_BRANCH:-branch-1.0}
|
2014-11-18 00:07:50 -05:00
|
|
|
RELEASE_VERSION=${RELEASE_VERSION:-1.2.0}
|
2015-03-03 03:38:12 -05:00
|
|
|
# Allows publishing under a different version identifier than
|
|
|
|
# was present in the actual release sources (e.g. rc-X)
|
|
|
|
PUBLISH_VERSION=${PUBLISH_VERSION:-$RELEASE_VERSION}
|
2014-11-18 00:07:50 -05:00
|
|
|
NEXT_VERSION=${NEXT_VERSION:-1.2.1}
|
2014-04-28 16:58:42 -04:00
|
|
|
RC_NAME=${RC_NAME:-rc2}
|
2014-11-18 00:07:50 -05:00
|
|
|
|
|
|
|
M2_REPO=~/.m2/repository
|
|
|
|
SPARK_REPO=$M2_REPO/org/apache/spark
|
|
|
|
NEXUS_ROOT=https://repository.apache.org/service/local/staging
|
|
|
|
NEXUS_PROFILE=d63f592e7eac0 # Profile for Spark staging uploads
|
2014-02-09 02:13:34 -05:00
|
|
|
|
2014-08-06 21:45:03 -04:00
|
|
|
if [ -z "$JAVA_HOME" ]; then
|
|
|
|
echo "Error: JAVA_HOME is not set, cannot proceed."
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
JAVA_7_HOME=${JAVA_7_HOME:-$JAVA_HOME}
|
|
|
|
|
2014-02-09 02:13:34 -05:00
|
|
|
set -e
|
|
|
|
|
2014-04-21 17:21:17 -04:00
|
|
|
GIT_TAG=v$RELEASE_VERSION-$RC_NAME
|
2014-02-09 02:13:34 -05:00
|
|
|
|
2015-02-03 00:00:30 -05:00
|
|
|
if [[ ! "$@" =~ --skip-create-release ]]; then
|
2014-11-18 00:07:50 -05:00
|
|
|
echo "Creating release commit and publishing to Apache repository"
|
2014-04-28 16:58:42 -04:00
|
|
|
# Artifact publishing
|
2014-11-18 00:07:50 -05:00
|
|
|
git clone https://$ASF_USERNAME:$ASF_PASSWORD@git-wip-us.apache.org/repos/asf/spark.git \
|
|
|
|
-b $GIT_BRANCH
|
|
|
|
pushd spark
|
2014-04-28 16:58:42 -04:00
|
|
|
export MAVEN_OPTS="-Xmx3g -XX:MaxPermSize=1g -XX:ReservedCodeCacheSize=1g"
|
2014-02-09 02:13:34 -05:00
|
|
|
|
2014-11-18 00:07:50 -05:00
|
|
|
# Create release commits and push them to github
|
|
|
|
# NOTE: This is done "eagerly" i.e. we don't check if we can succesfully build
|
|
|
|
# or before we coin the release commit. This helps avoid races where
|
|
|
|
# other people add commits to this branch while we are in the middle of building.
|
2014-12-04 15:11:41 -05:00
|
|
|
cur_ver="${RELEASE_VERSION}-SNAPSHOT"
|
|
|
|
rel_ver="${RELEASE_VERSION}"
|
|
|
|
next_ver="${NEXT_VERSION}-SNAPSHOT"
|
|
|
|
|
|
|
|
old="^\( \{2,4\}\)<version>${cur_ver}<\/version>$"
|
|
|
|
new="\1<version>${rel_ver}<\/version>"
|
|
|
|
find . -name pom.xml | grep -v dev | xargs -I {} sed -i \
|
|
|
|
-e "s/${old}/${new}/" {}
|
|
|
|
find . -name package.scala | grep -v dev | xargs -I {} sed -i \
|
|
|
|
-e "s/${old}/${new}/" {}
|
|
|
|
|
2014-11-18 00:07:50 -05:00
|
|
|
git commit -a -m "Preparing Spark release $GIT_TAG"
|
|
|
|
echo "Creating tag $GIT_TAG at the head of $GIT_BRANCH"
|
|
|
|
git tag $GIT_TAG
|
|
|
|
|
2014-12-04 15:11:41 -05:00
|
|
|
old="^\( \{2,4\}\)<version>${rel_ver}<\/version>$"
|
|
|
|
new="\1<version>${next_ver}<\/version>"
|
|
|
|
find . -name pom.xml | grep -v dev | xargs -I {} sed -i \
|
2014-11-18 00:07:50 -05:00
|
|
|
-e "s/$old/$new/" {}
|
2014-12-04 15:11:41 -05:00
|
|
|
find . -name package.scala | grep -v dev | xargs -I {} sed -i \
|
|
|
|
-e "s/${old}/${new}/" {}
|
|
|
|
git commit -a -m "Preparing development version $next_ver"
|
2014-11-18 00:07:50 -05:00
|
|
|
git push origin $GIT_TAG
|
|
|
|
git push origin HEAD:$GIT_BRANCH
|
2015-02-03 00:00:30 -05:00
|
|
|
popd
|
|
|
|
rm -rf spark
|
|
|
|
fi
|
[SPARK-4501][Core] - Create build/mvn to automatically download maven/zinc/scalac
Creates a top level directory script (as `build/mvn`) to automatically download zinc and the specific version of scala used to easily build spark. This will also download and install maven if the user doesn't already have it and all packages are hosted under the `build/` directory. Tested on both Linux and OSX OS's and both work. All commands pass through to the maven binary so it acts exactly as a traditional maven call would.
Author: Brennon York <brennon.york@capitalone.com>
Closes #3707 from brennonyork/SPARK-4501 and squashes the following commits:
0e5a0e4 [Brennon York] minor incorrect doc verbage (with -> this)
9b79e38 [Brennon York] fixed merge conflicts with dev/run-tests, properly quoted args in sbt/sbt, fixed bug where relative paths would fail if passed in from build/mvn
d2d41b6 [Brennon York] added blurb about leverging zinc with build/mvn
b979c58 [Brennon York] updated the merge conflict
c5634de [Brennon York] updated documentation to overview build/mvn, updated all points where sbt/sbt was referenced with build/sbt
b8437ba [Brennon York] set progress bars for curl and wget when not run on jenkins, no progress bar when run on jenkins, moved sbt script to build/sbt, wrote stub and warning under sbt/sbt which calls build/sbt, modified build/sbt to use the correct directory, fixed bug in build/sbt-launch-lib.bash to correctly pull the sbt version
be11317 [Brennon York] added switch to silence download progress only if AMPLAB_JENKINS is set
28d0a99 [Brennon York] updated to remove the python dependency, uses grep instead
7e785a6 [Brennon York] added silent and quiet flags to curl and wget respectively, added single echo output to denote start of a download if download is needed
14a5da0 [Brennon York] removed unnecessary zinc output on startup
1af4a94 [Brennon York] fixed bug with uppercase vs lowercase variable
3e8b9b3 [Brennon York] updated to properly only restart zinc if it was freshly installed
a680d12 [Brennon York] Added comments to functions and tested various mvn calls
bb8cc9d [Brennon York] removed package files
ef017e6 [Brennon York] removed OS complexities, setup generic install_app call, removed extra file complexities, removed help, removed forced install (defaults now), removed double-dash from cli
07bf018 [Brennon York] Updated to specifically handle pulling down the correct scala version
f914dea [Brennon York] Beginning final portions of localized scala home
69c4e44 [Brennon York] working linux and osx installers for purely local mvn build
4a1609c [Brennon York] finalizing working linux install for maven to local ./build/apache-maven folder
cbfcc68 [Brennon York] Changed the default sbt/sbt to build/sbt and added a build/mvn which will automatically download, install, and execute maven with zinc for easier build capability
2014-12-27 16:25:18 -05:00
|
|
|
|
2015-02-03 00:00:30 -05:00
|
|
|
if [[ ! "$@" =~ --skip-publish ]]; then
|
|
|
|
git clone https://$ASF_USERNAME:$ASF_PASSWORD@git-wip-us.apache.org/repos/asf/spark.git
|
|
|
|
pushd spark
|
|
|
|
git checkout --force $GIT_TAG
|
|
|
|
|
2015-03-03 03:38:12 -05:00
|
|
|
# Substitute in case published version is different than released
|
|
|
|
old="^\( \{2,4\}\)<version>${RELEASE_VERSION}<\/version>$"
|
|
|
|
new="\1<version>${PUBLISH_VERSION}<\/version>"
|
|
|
|
find . -name pom.xml | grep -v dev | xargs -I {} sed -i \
|
|
|
|
-e "s/${old}/${new}/" {}
|
|
|
|
|
2014-11-18 00:07:50 -05:00
|
|
|
# Using Nexus API documented here:
|
|
|
|
# https://support.sonatype.com/entries/39720203-Uploading-to-a-Staging-Repository-via-REST-API
|
|
|
|
echo "Creating Nexus staging repository"
|
2015-03-03 03:38:12 -05:00
|
|
|
repo_request="<promoteRequest><data><description>Apache Spark $GIT_TAG (published as $PUBLISH_VERSION)</description></data></promoteRequest>"
|
2014-11-18 00:07:50 -05:00
|
|
|
out=$(curl -X POST -d "$repo_request" -u $ASF_USERNAME:$ASF_PASSWORD \
|
|
|
|
-H "Content-Type:application/xml" -v \
|
|
|
|
$NEXUS_ROOT/profiles/$NEXUS_PROFILE/start)
|
|
|
|
staged_repo_id=$(echo $out | sed -e "s/.*\(orgapachespark-[0-9]\{4\}\).*/\1/")
|
|
|
|
echo "Created Nexus staging repository: $staged_repo_id"
|
|
|
|
|
2015-03-12 21:36:17 -04:00
|
|
|
rm -rf $SPARK_REPO
|
|
|
|
|
2015-03-03 03:38:12 -05:00
|
|
|
build/mvn -DskipTests -Dhadoop.version=2.2.0 -Dyarn.version=2.2.0 \
|
2015-04-27 14:27:56 -04:00
|
|
|
-Pyarn -Phive -Phive-thriftserver -Phadoop-2.2 -Pspark-ganglia-lgpl -Pkinesis-asl \
|
2014-11-18 00:07:50 -05:00
|
|
|
clean install
|
2014-02-09 02:13:34 -05:00
|
|
|
|
2014-11-18 00:07:50 -05:00
|
|
|
./dev/change-version-to-2.11.sh
|
2015-02-03 00:00:30 -05:00
|
|
|
|
2015-03-03 03:38:12 -05:00
|
|
|
build/mvn -DskipTests -Dhadoop.version=2.2.0 -Dyarn.version=2.2.0 \
|
2014-11-18 00:07:50 -05:00
|
|
|
-Dscala-2.11 -Pyarn -Phive -Phadoop-2.2 -Pspark-ganglia-lgpl -Pkinesis-asl \
|
|
|
|
clean install
|
|
|
|
|
|
|
|
./dev/change-version-to-2.10.sh
|
|
|
|
|
|
|
|
pushd $SPARK_REPO
|
|
|
|
|
|
|
|
# Remove any extra files generated during install
|
|
|
|
find . -type f |grep -v \.jar |grep -v \.pom | xargs rm
|
|
|
|
|
|
|
|
echo "Creating hash and signature files"
|
|
|
|
for file in $(find . -type f)
|
|
|
|
do
|
|
|
|
echo $GPG_PASSPHRASE | gpg --passphrase-fd 0 --output $file.asc --detach-sig --armour $file;
|
2015-01-27 13:22:50 -05:00
|
|
|
if [ $(command -v md5) ]; then
|
|
|
|
# Available on OS X; -q to keep only hash
|
|
|
|
md5 -q $file > $file.md5
|
|
|
|
else
|
|
|
|
# Available on Linux; cut to keep only hash
|
|
|
|
md5sum $file | cut -f1 -d' ' > $file.md5
|
|
|
|
fi
|
|
|
|
shasum -a 1 $file | cut -f1 -d' ' > $file.sha1
|
2014-11-18 00:07:50 -05:00
|
|
|
done
|
|
|
|
|
2014-12-04 15:11:41 -05:00
|
|
|
nexus_upload=$NEXUS_ROOT/deployByRepositoryId/$staged_repo_id
|
|
|
|
echo "Uplading files to $nexus_upload"
|
2014-11-18 00:07:50 -05:00
|
|
|
for file in $(find . -type f)
|
|
|
|
do
|
|
|
|
# strip leading ./
|
|
|
|
file_short=$(echo $file | sed -e "s/\.\///")
|
2014-12-04 15:11:41 -05:00
|
|
|
dest_url="$nexus_upload/org/apache/spark/$file_short"
|
2014-11-18 00:07:50 -05:00
|
|
|
echo " Uploading $file_short"
|
|
|
|
curl -u $ASF_USERNAME:$ASF_PASSWORD --upload-file $file_short $dest_url
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "Closing nexus staging repository"
|
2015-03-12 21:36:17 -04:00
|
|
|
repo_request="<promoteRequest><data><stagedRepositoryId>$staged_repo_id</stagedRepositoryId><description>Apache Spark $GIT_TAG (published as $PUBLISH_VERSION)</description></data></promoteRequest>"
|
2014-11-18 00:07:50 -05:00
|
|
|
out=$(curl -X POST -d "$repo_request" -u $ASF_USERNAME:$ASF_PASSWORD \
|
|
|
|
-H "Content-Type:application/xml" -v \
|
|
|
|
$NEXUS_ROOT/profiles/$NEXUS_PROFILE/finish)
|
|
|
|
echo "Closed Nexus staging repository: $staged_repo_id"
|
|
|
|
|
|
|
|
popd
|
|
|
|
popd
|
2014-04-28 16:58:42 -04:00
|
|
|
rm -rf spark
|
|
|
|
fi
|
2014-02-09 02:13:34 -05:00
|
|
|
|
2015-02-03 00:00:30 -05:00
|
|
|
if [[ ! "$@" =~ --skip-package ]]; then
|
|
|
|
# Source and binary tarballs
|
|
|
|
echo "Packaging release tarballs"
|
|
|
|
git clone https://git-wip-us.apache.org/repos/asf/spark.git
|
|
|
|
cd spark
|
|
|
|
git checkout --force $GIT_TAG
|
|
|
|
release_hash=`git rev-parse HEAD`
|
|
|
|
|
|
|
|
rm .gitignore
|
|
|
|
rm -rf .git
|
2014-02-09 02:13:34 -05:00
|
|
|
cd ..
|
2015-02-03 00:00:30 -05:00
|
|
|
|
|
|
|
cp -r spark spark-$RELEASE_VERSION
|
|
|
|
tar cvzf spark-$RELEASE_VERSION.tgz spark-$RELEASE_VERSION
|
|
|
|
echo $GPG_PASSPHRASE | gpg --passphrase-fd 0 --armour --output spark-$RELEASE_VERSION.tgz.asc \
|
|
|
|
--detach-sig spark-$RELEASE_VERSION.tgz
|
|
|
|
echo $GPG_PASSPHRASE | gpg --passphrase-fd 0 --print-md MD5 spark-$RELEASE_VERSION.tgz > \
|
|
|
|
spark-$RELEASE_VERSION.tgz.md5
|
|
|
|
echo $GPG_PASSPHRASE | gpg --passphrase-fd 0 --print-md SHA512 spark-$RELEASE_VERSION.tgz > \
|
|
|
|
spark-$RELEASE_VERSION.tgz.sha
|
|
|
|
rm -rf spark-$RELEASE_VERSION
|
2015-03-12 21:36:17 -04:00
|
|
|
|
|
|
|
# Updated for each binary build
|
2015-02-03 00:00:30 -05:00
|
|
|
make_binary_release() {
|
|
|
|
NAME=$1
|
|
|
|
FLAGS=$2
|
2015-03-12 21:36:17 -04:00
|
|
|
ZINC_PORT=$3
|
2015-02-03 00:00:30 -05:00
|
|
|
cp -r spark spark-$RELEASE_VERSION-bin-$NAME
|
|
|
|
|
|
|
|
cd spark-$RELEASE_VERSION-bin-$NAME
|
|
|
|
|
|
|
|
# TODO There should probably be a flag to make-distribution to allow 2.11 support
|
|
|
|
if [[ $FLAGS == *scala-2.11* ]]; then
|
|
|
|
./dev/change-version-to-2.11.sh
|
|
|
|
fi
|
|
|
|
|
2015-03-12 21:36:17 -04:00
|
|
|
export ZINC_PORT=$ZINC_PORT
|
|
|
|
echo "Creating distribution: $NAME ($FLAGS)"
|
|
|
|
./make-distribution.sh --name $NAME --tgz $FLAGS -DzincPort=$ZINC_PORT 2>&1 > \
|
|
|
|
../binary-release-$NAME.log
|
2015-02-03 00:00:30 -05:00
|
|
|
cd ..
|
|
|
|
cp spark-$RELEASE_VERSION-bin-$NAME/spark-$RELEASE_VERSION-bin-$NAME.tgz .
|
|
|
|
|
|
|
|
echo $GPG_PASSPHRASE | gpg --passphrase-fd 0 --armour \
|
|
|
|
--output spark-$RELEASE_VERSION-bin-$NAME.tgz.asc \
|
|
|
|
--detach-sig spark-$RELEASE_VERSION-bin-$NAME.tgz
|
|
|
|
echo $GPG_PASSPHRASE | gpg --passphrase-fd 0 --print-md \
|
|
|
|
MD5 spark-$RELEASE_VERSION-bin-$NAME.tgz > \
|
|
|
|
spark-$RELEASE_VERSION-bin-$NAME.tgz.md5
|
|
|
|
echo $GPG_PASSPHRASE | gpg --passphrase-fd 0 --print-md \
|
|
|
|
SHA512 spark-$RELEASE_VERSION-bin-$NAME.tgz > \
|
|
|
|
spark-$RELEASE_VERSION-bin-$NAME.tgz.sha
|
|
|
|
}
|
|
|
|
|
2015-03-12 21:36:17 -04:00
|
|
|
# We increment the Zinc port each time to avoid OOM's and other craziness if multiple builds
|
|
|
|
# share the same Zinc server.
|
|
|
|
make_binary_release "hadoop1" "-Phive -Phive-thriftserver -Dhadoop.version=1.0.4" "3030" &
|
|
|
|
make_binary_release "hadoop1-scala2.11" "-Phive -Dscala-2.11" "3031" &
|
|
|
|
make_binary_release "cdh4" "-Phive -Phive-thriftserver -Dhadoop.version=2.0.0-mr1-cdh4.2.0" "3032" &
|
|
|
|
make_binary_release "hadoop2.3" "-Phadoop-2.3 -Phive -Phive-thriftserver -Pyarn" "3033" &
|
|
|
|
make_binary_release "hadoop2.4" "-Phadoop-2.4 -Phive -Phive-thriftserver -Pyarn" "3034" &
|
|
|
|
make_binary_release "mapr3" "-Pmapr3 -Phive -Phive-thriftserver" "3035" &
|
|
|
|
make_binary_release "mapr4" "-Pmapr4 -Pyarn -Phive -Phive-thriftserver" "3036" &
|
|
|
|
make_binary_release "hadoop2.4-without-hive" "-Phadoop-2.4 -Pyarn" "3037" &
|
2015-02-03 00:00:30 -05:00
|
|
|
wait
|
2015-03-12 21:36:17 -04:00
|
|
|
rm -rf spark-$RELEASE_VERSION-bin-*/
|
2015-02-03 00:00:30 -05:00
|
|
|
|
|
|
|
# Copy data
|
|
|
|
echo "Copying release tarballs"
|
|
|
|
rc_folder=spark-$RELEASE_VERSION-$RC_NAME
|
|
|
|
ssh $ASF_USERNAME@people.apache.org \
|
|
|
|
mkdir /home/$ASF_USERNAME/public_html/$rc_folder
|
|
|
|
scp spark-* \
|
|
|
|
$ASF_USERNAME@people.apache.org:/home/$ASF_USERNAME/public_html/$rc_folder/
|
|
|
|
|
|
|
|
# Docs
|
|
|
|
cd spark
|
|
|
|
sbt/sbt clean
|
|
|
|
cd docs
|
|
|
|
# Compile docs with Java 7 to use nicer format
|
2015-02-25 18:13:34 -05:00
|
|
|
JAVA_HOME="$JAVA_7_HOME" PRODUCTION=1 RELEASE_VERSION="$RELEASE_VERSION" jekyll build
|
2015-02-03 00:00:30 -05:00
|
|
|
echo "Copying release documentation"
|
|
|
|
rc_docs_folder=${rc_folder}-docs
|
|
|
|
ssh $ASF_USERNAME@people.apache.org \
|
|
|
|
mkdir /home/$ASF_USERNAME/public_html/$rc_docs_folder
|
|
|
|
rsync -r _site/* $ASF_USERNAME@people.apache.org:/home/$ASF_USERNAME/public_html/$rc_docs_folder
|
|
|
|
|
|
|
|
echo "Release $RELEASE_VERSION completed:"
|
|
|
|
echo "Git tag:\t $GIT_TAG"
|
|
|
|
echo "Release commit:\t $release_hash"
|
|
|
|
echo "Binary location:\t http://people.apache.org/~$ASF_USERNAME/$rc_folder"
|
|
|
|
echo "Doc location:\t http://people.apache.org/~$ASF_USERNAME/$rc_docs_folder"
|
|
|
|
fi
|