blob: 5fbf6dec0c32125c6223e6d58675983ef90f0b59 [file] [log] [blame]
#!/usr/bin/env bash
# This script should be used for calling a vote for a release candidate.
# In addition to publishing the source tarball to svn repo this script
# also deploys the corresponding jar to a staging Maven repo.
set -e
# Use 'atexit' for cleanup.
. $(dirname ${0})/
# Use colors for errors.
. $(dirname ${0})/
test ${#} -eq 2 || \
{ echo "Usage: `basename ${0}` [version] [candidate]"; exit 1; }
if ! git rev-parse "$TAG" > /dev/null 2>&1; then
echo "Tag $TAG doesn't exist. Please create one using:"
echo " git tag -a $TAG -m \"Tagging Mesos $TAG.\""
exit 1
if [ "$(git cat-file -t $TAG)" != "tag" ]; then
echo "Tag $TAG is not annotated. First delete the existing tag using:"
echo " git tag -d $TAG"
echo "Then create an annotated tag using:"
echo " git tag -a $TAG -m \"Tagging Mesos $TAG.\""
exit 1;
# Releases are signed with `sha512sum` which is installed as
# `gsha512sum` from Homebrew's `coreutils` package.
echo "Checking for sha512sum or gsha512sum"
SHA512SUM=$(command -v sha512sum || command -v gsha512sum)
echo "${GREEN}Tagging and Voting for mesos-${VERSION} candidate ${CANDIDATE}${NORMAL}"
read -p "Hit enter to continue ... "
# Get the absolute path of the local git clone.
MESOS_GIT_LOCAL=$(cd "$(dirname $0)"/..; pwd)
WORK_DIR=`mktemp -d /tmp/mesos-tag-vote-XXXX`
atexit "rm -rf ${WORK_DIR}"
pushd ${WORK_DIR}
echo "${GREEN}Checking out ${TAG}${NORMAL}"
# Make a shallow clone from the local git repository.
git clone --shared ${MESOS_GIT_LOCAL} --branch ${TAG} mesos
pushd mesos
# Ensure has the correct version.
grep "\[mesos\], \[${VERSION}\]"
# Build mesos.
mkdir build
pushd build
../configure --disable-optimize
# First build the protobuf compiler.
# TODO(vinod): This is short term fix for MESOS-959.
pushd 3rdparty
make -j3
# Build and deploy the jar.
make -j3 maven-install
mvn deploy -f src/java/mesos.pom
echo "${GREEN}Successfully deployed the jar to staging maven repository ...${NORMAL}"
# Loop here until the user enters a URL.
while [ -z ${MAVEN_REPO} ]; do
read -p "Please *close* the staging repository and provide its URL here: " MAVEN_REPO
echo "${GREEN}Pushing the git tag to the repository...${NORMAL}"
git push ${MESOS_GIT_URL} refs/tags/${TAG}
# Build the distribution.
echo "${GREEN}Building the distribution ...${NORMAL}"
make -j3 dist
echo "${GREEN}Signing the distribution ...${NORMAL}"
# Sign the tarball.
gpg --armor --output ${TARBALL}.asc --detach-sig ${TARBALL}
echo "${GREEN}Creating a SHA512 checksum ...${NORMAL}"
# Create SHA512 checksum.
"${SHA512SUM}" ${TARBALL} > ${TARBALL}.sha512
echo "${GREEN}Checking out svn dev repo ...${NORMAL}"
# Note '--depth=empty' ensures none of the existing files
# in the repo are checked out, saving time and space.
svn co --depth=empty ${SVN_DEV_REPO} ${SVN_DEV_LOCAL}
echo "${GREEN}Uploading the artifacts (the distribution," \
"signature, and checksum) ...${NORMAL}"
popd # build
popd # mesos
pushd ${SVN_DEV_LOCAL}
svn add ${TAG}
svn commit -m "Adding mesos-${TAG}."
popd # ${SVN_DEV_LOCAL}
popd # ${WORK_DIR}
echo "${GREEN}Success! Now send the following VOTE email ...${NORMAL}"
# Create the email body template to be sent to {dev,user}
MESSAGE=$(cat <<__EOF__
Subject: [VOTE] Release Apache Mesos ${VERSION} (rc${CANDIDATE})
Hi all,
Please vote on releasing the following candidate as Apache Mesos ${VERSION}.
${VERSION} includes the following:
*****Announce major features here*****
*****Announce major bug fixes here*****
The CHANGELOG for the release is available at:;a=blob_plain;f=CHANGELOG;hb=${TAG}
The candidate for Mesos ${VERSION} release is available at:
The tag to be voted on is ${TAG}:;a=commit;h=${TAG}
The SHA512 checksum of the tarball can be found at:
The signature of the tarball can be found at:
The PGP key used to sign the release is here:
The JAR is in a staging repository here:
Please vote on releasing this package as Apache Mesos ${VERSION}!
The vote is open until `date -v+3d` and passes if a majority of at least 3 +1 PMC votes are cast.
[ ] +1 Release this package as Apache Mesos ${VERSION}
[ ] -1 Do not release this package because ...
echo "${MESSAGE}"
exit 0