Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7686A180BF for ; Fri, 22 Jan 2016 17:58:07 +0000 (UTC) Received: (qmail 21326 invoked by uid 500); 22 Jan 2016 17:58:07 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 21272 invoked by uid 500); 22 Jan 2016 17:58:07 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 21110 invoked by uid 99); 22 Jan 2016 17:58:07 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Jan 2016 17:58:07 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0FF96E054A; Fri, 22 Jan 2016 17:58:07 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ctubbsii@apache.org To: commits@accumulo.apache.org Date: Fri, 22 Jan 2016 17:58:09 -0000 Message-Id: <34f70660f1c64cbab1b72f2f11bfe9c4@git.apache.org> In-Reply-To: <6fb74208dcfe4c97ae1a7f3c9825143c@git.apache.org> References: <6fb74208dcfe4c97ae1a7f3c9825143c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [03/12] accumulo git commit: ACCUMULO-4109 Automate RC builds more ACCUMULO-4109 Automate RC builds more Prompt for minimal information and automate release candidate staging and branching as much as possible * Colorize output * Ensure it passes shellcheck * Handle failures wherever possible * Handle creating test RCs easier, with --extraReleaseArgs * Attempt to handle differences in credential caching support in gpg/gpg2 * Log output of mvn to a temp file for review * Verify branches after release candidate is pushed * Provide assistance uploading branches for voting * Provide instructions on next steps Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/34bd2633 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/34bd2633 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/34bd2633 Branch: refs/heads/master Commit: 34bd2633584b827834c47461c705f0493304e600 Parents: 27300d8 Author: Christopher Tubbs Authored: Wed Jan 13 22:45:03 2016 -0500 Committer: Christopher Tubbs Committed: Fri Jan 22 12:09:46 2016 -0500 ---------------------------------------------------------------------- assemble/build.sh | 279 +++++++++++++++++++++++++++++++++++++------------ pom.xml | 4 +- 2 files changed, 214 insertions(+), 69 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/34bd2633/assemble/build.sh ---------------------------------------------------------------------- diff --git a/assemble/build.sh b/assemble/build.sh index 0f76376..76bbb48 100755 --- a/assemble/build.sh +++ b/assemble/build.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#! /usr/bin/env bash # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -15,134 +15,277 @@ # See the License for the specific language governing permissions and # limitations under the License. -loc=`dirname "$0"` -loc=`cd "$loc/.."; pwd` +cd "$(dirname "$0")/.." || exit 1 +scriptname=$(basename "$0") -cd "$loc" +# check for gpg2 +hash gpg2 2>/dev/null && gpgCommand=gpg2 || gpgCommand=gpg -fail() { - echo ' ' $@ - exit 1 +# check if running in a color terminal +terminalSupportsColor() { + local c; c=$(tput colors 2>/dev/null) || c=-1 + [[ -t 1 ]] && [[ $c -ge 8 ]] } +terminalSupportsColor && doColor=1 || doColor=0 -run() { - echo $@ - eval $@ - if [ $? -ne 0 ] - then - fail $@ fails - fi -} +color() { local c; c=$1; shift; [[ $doColor -eq 1 ]] && echo -e "\\e[0;${c}m${*}\\e[0m" || echo "$@"; } +red() { color 31 "$@"; } +green() { color 32 "$@"; } +yellow() { color 33 "$@"; } -runAt() { - ( cd $1 ; echo in `pwd`; shift ; run $@ ) || fail -} +fail() { echo -e ' ' "$@"; exit 1; } +runLog() { local o; o=$1 && shift && echo "$(green Running) $(yellow "$@" '>>' "$o")" && echo Running "$@" >> "$o" && eval "$@" >> "$o"; } +run() { echo "$(green Running) $(yellow "$@")" && eval "$@"; } +runOrFail() { run "$@" || fail "$(yellow "$@")" "$(red failed)"; } + +currentBranch() { local b; b=$(git symbolic-ref -q HEAD) && echo "${b##refs/heads/}"; } cacheGPG() { # make sure gpg agent has key cached # TODO prompt for key instead of using default? - TESTFILE="/tmp/${USER}-gpgTestFile-$(date -u +%s).txt" - touch "${TESTFILE}" && gpg --sign "${TESTFILE}" && rm -f "${TESTFILE}" "${TESTFILE}.gpg" + local TESTFILE; TESTFILE=$(mktemp --tmpdir "${USER}-gpgTestFile-XXXXXXXX.txt") + [[ -r $TESTFILE ]] && "$gpgCommand" --sign "${TESTFILE}" && rm -f "${TESTFILE}" "${TESTFILE}.gpg" } +prompter() { + # $1 description; $2 pattern to validate against + local x + read -r -p "Enter the $1: " x + until eval "[[ \$x =~ ^$2\$ ]]"; do + echo " $(red "$x") is not a proper $1" 1>&2 + read -r -p "Enter the $1: " x + done + echo "$x" +} + +pretty() { local f; f=$1; shift; git log "--pretty=tformat:$f" "$@"; } +gitCommits() { pretty %H "$@"; } +gitCommit() { gitCommits -n1 "$@"; } +gitSubject() { pretty %s "$@"; } + createEmail() { - read -p 'Enter the staging repository number: ' stagingrepo - read -p 'Enter the version to be released (eg. x.y.z): ' tag - read -p 'Enter the release candidate number (eg. 1, 2, etc.): ' rc + # $1 version (optional); $2 rc seqence num (optional); $3 staging repo num (optional) + local ver; [[ -n $1 ]] && ver=$1 || ver=$(prompter 'version to be released (eg. x.y.z)' '[0-9]+[.][0-9]+[.][0-9]+') + local rc; [[ -n $2 ]] && rc=$2 || rc=$(prompter 'release candidate sequence number (eg. 1, 2, etc.)' '[0-9]+') + local stagingrepo; [[ -n $3 ]] && stagingrepo=$3 || stagingrepo=$(prompter 'staging repository number from https://repository.apache.org/#stagingRepositories' '[0-9]+') - commit=$(git show $tag -n1 --pretty=raw --no-color | head -1 | awk '{print $2}') - branch=$tag-rc$rc + local branch; branch=$ver-rc$rc + local commit; commit=$(gitCommit "$branch") || exit 1 + local tag; tag=rel/$ver echo - echo "IMPORTANT!! IMPORTANT!! IMPORTANT!! IMPORTANT!! IMPORTANT!! IMPORTANT!!" + yellow "IMPORTANT!! IMPORTANT!! IMPORTANT!! IMPORTANT!! IMPORTANT!! IMPORTANT!!" echo - echo " Don't forget to push a branch named $branch with" - echo " its head at ${commit:0:7} so people can review!" + echo " Don't forget to push a branch named $(green "$branch") with" + echo " its head at $(green "${commit:0:7}") so others can review using:" + echo " $(green "git push origin ${commit:0:7}:refs/heads/$branch")" echo - echo " However, do *NOT* push the $tag tag until after the vote" - echo " passes and the tag is re-made with a gpg signature using" - echo " \`git tag -f -m 'Apache Accumulo $tag' -s rel/$tag ${commit:0:7}\`" + echo " Remember, $(red DO NOT PUSH) the $(red "$tag") tag until after the vote" + echo " passes and the tag is re-made with a gpg signature using:" + echo " $(red "git tag -f -m 'Apache Accumulo $ver' -s $tag ${commit:0:7}")" echo - echo "IMPORTANT!! IMPORTANT!! IMPORTANT!! IMPORTANT!! IMPORTANT!! IMPORTANT!!" + yellow "IMPORTANT!! IMPORTANT!! IMPORTANT!! IMPORTANT!! IMPORTANT!! IMPORTANT!!" echo - read -p 'Press Enter to generate the [VOTE] email...' rc + read -r -s -p 'Press Enter to generate the [VOTE] email...' + echo 1>&2 # compute the date with a buffer of 30 minutes - votedate=$(date -d "+3 days 30 minutes" "+%s") + local votedate; votedate=$(date -d "+3 days 30 minutes" "+%s") # round back to the previous half-hour - halfhour=$(($votedate - ($votedate % 1800))) + local halfhour; halfhour=$((votedate - (votedate % 1800))) votedate=$(date -u -d"1970-01-01 $halfhour seconds UTC") export TZ="America/New_York" - edtvotedate=$(date -d"1970-01-01 $halfhour seconds UTC") + local edtvotedate; edtvotedate=$(date -d"1970-01-01 $halfhour seconds UTC") export TZ="America/Los_Angeles" - pdtvotedate=$(date -d"1970-01-01 $halfhour seconds UTC") + local pdtvotedate; pdtvotedate=$(date -d"1970-01-01 $halfhour seconds UTC") - cat </dev/null | awk -F: '$1 == "fpr" {print $10}') + [[ -z $fingerprint ]] && fingerprint="UNSPECIFIED" + cat <1.50 ${project.parent.basedir}/contrib/Eclipse-Accumulo-Codestyle.xml + + 2.5.5 @@ -621,7 +623,7 @@ 2.5 - -P !autoformat,apache-release,thrift,assemble,docs,sunny -Dtimeout.factor=2 + -P !autoformat,apache-release,thrift,assemble,docs,sunny -Dtimeout.factor=2 ${extraReleaseArgs} true clean deploy clean verify