blob: c5a8fa2f528ec44a4f26604ac0dbd2a72c75a773 [file] [log] [blame]
#!/bin/bash
# This script should be run after using `./build-artifact` to create rpms
# and debs. It will checksum and sign the artifacts and produce tarballs
# suitable for upload and explosion in a bintray repository.
set -o errexit
set -o nounset
set -o pipefail
RELEASE=$(git rev-parse --abbrev-ref HEAD)
if [[ "$RELEASE" = "master" ]]; then
echo "This script must be run from a branch named for the release, e.g. 0.16.x"
exit 1
fi
ROOT_DIR=$(git rev-parse --show-toplevel)
cd "${ROOT_DIR}"
declare -A DIST_DIRS=(
["ubuntu-xenial"]="${ROOT_DIR}/artifacts/aurora-ubuntu-xenial/dist"
["debian-jessie"]="${ROOT_DIR}/artifacts/aurora-debian-jessie/dist"
["centos-7"]="${ROOT_DIR}/artifacts/aurora-centos-7/dist/rpmbuild/RPMS/x86_64"
)
function oses() {
echo "${!DIST_DIRS[@]}"
}
function dist_dir() {
local os="$1"
echo "${DIST_DIRS["${os}"]}"
}
function sign_artifacts() {
local os="$1"
local dist_dir="$2"
local stage_dir="$3"
pushd ${dist_dir}
find . -maxdepth 1 -type f | while read file; do
local name=$(basename "${file}")
# Sign the tarball.
gpg --armor --output "${stage_dir}/${name}.asc" --detach-sig "${name}"
# Create the checksums
shasum -a 512 "${name}" > "${stage_dir}/${name}.sha512"
done
popd
}
function zip_artifacts() {
local os="$1"
local dist_dir="$2"
local stage_dir="$3"
rm -rf "${stage_dir}/${os}" && mkdir -p "${stage_dir}/${os}"
find "${dist_dir}" "${stage_dir}" -maxdepth 1 -type f | while read file; do
ln -s ${file} "${stage_dir}/${os}/$(basename ${file})"
done
local tarball="$(dirname ${dist_dir})/upload.tar"
tar -chf "${tarball}" -C "${stage_dir}" "${os}"
echo "${tarball}"
}
for os in $(oses); do
dist_dir="$(dist_dir ${os})"
if [[ -d "${dist_dir}" ]]; then
stage_dir="${dist_dir}/.stage"
rm -rf "${stage_dir}" && mkdir -p "${stage_dir}"
echo "Signing artifacts for ${os}..."
sign_artifacts "${os}" "${dist_dir}" "${stage_dir}"
archive="$(zip_artifacts "${os}" "${dist_dir}" "${stage_dir}")"
echo "Created archive for ${os} artifacts at ${archive}."
else
echo "Skipping artifacts for ${os} (not found built under ${dist_dir})."
fi
done
echo "All artifacts prepared for upload to bintray. The following draft email has been created"
echo "to send to the dev@aurora.apache.org mailing list"
echo
# Create the email template for the release candidate to be sent to the mailing lists.
if [[ $(uname) == Darwin ]]; then
vote_end=$(date -v+3d)
else
vote_end=$(date -d+3days)
fi
MESSAGE=$(cat <<__EOF__
To: dev@aurora.apache.org
Subject: [VOTE] Release Apache Aurora $RELEASE packages
All,
I propose that we accept the following artifacts as the official deb and rpm packaging for
Apache Aurora ${RELEASE}:
https://dl.bintray.com/${USER}/aurora/
The Aurora deb and rpm packaging includes the following:
---
The branch used to create the packaging is:
https://git1-us-west.apache.org/repos/asf?p=aurora-packaging.git;a=tree;hb=refs/heads/${RELEASE}
The packages are available at:
https://dl.bintray.com/${USER}/aurora/
The GPG keys used to sign the packages are available at:
https://dist.apache.org/repos/dist/release/aurora/KEYS
Please download, verify, and test. Detailed test instructions are available here:
https://git1-us-west.apache.org/repos/asf?p=aurora-packaging.git;a=tree;f=test;hb=refs/heads/${RELEASE}
The vote will close on ${vote_end}
[ ] +1 Release these as the deb and rpm packages for Apache Aurora ${RELEASE}
[ ] +0
[ ] -1 Do not release these artifacts because...
__EOF__
)
echo "--------------------------------------------------------------------------------"
echo
echo "${MESSAGE}"
echo
echo "--------------------------------------------------------------------------------"
echo