Allow nightly build script to email failures
parent
fa5de49d2e
commit
d5000c6500
36
nightly.sh
36
nightly.sh
|
@ -1,8 +1,35 @@
|
|||
#!/bin/bash
|
||||
|
||||
SWAKS="/root/swaks"
|
||||
|
||||
# Bump this whenever a release branch is created from master
|
||||
MASTER_VERSION=0.9.5
|
||||
|
||||
# send_failure_notification sends an e-mail with a build failure notification.
|
||||
function send_failure_notification {
|
||||
smtp=$1
|
||||
user=$2
|
||||
password=$3
|
||||
to=$4
|
||||
version=$5
|
||||
$SWAKS --auth \
|
||||
--server $smtp \
|
||||
--au $user \
|
||||
--ap $password \
|
||||
--to $to \
|
||||
--h-Subject: "Nightly build has FAILED" \
|
||||
--body "The nightly build has failed, version: $version"
|
||||
}
|
||||
|
||||
if [ $# -ne 4 ]; then
|
||||
echo "$0 <smtp server> <user> <password> <to>"
|
||||
exit 1
|
||||
fi
|
||||
SMTP=$1
|
||||
USER=$2
|
||||
PASSWORD=$3
|
||||
TO=$4
|
||||
|
||||
REPO_DIR=`mktemp -d`
|
||||
echo "Using $REPO_DIR for all work..."
|
||||
|
||||
|
@ -13,5 +40,12 @@ cd $GOPATH/src/github.com/influxdb
|
|||
git clone https://github.com/influxdb/influxdb.git
|
||||
|
||||
cd $GOPATH/src/github.com/influxdb/influxdb
|
||||
NIGHTLY_BUILD=true ./package.sh $MASTER_VERSION-nightly-`git log --pretty=format:'%h' -n 1`
|
||||
VERSION="$MASTER_VERSION-nightly-`git log --pretty=format:'%h' -n 1`"
|
||||
NIGHTLY_BUILD=true ./package.sh $VERSION
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
# Send notification e-mail.
|
||||
send_failure_notification $SMTP $USER $PASSWORD $TO $VERSION
|
||||
fi
|
||||
|
||||
rm -rf $REPO_DIR
|
||||
|
|
Loading…
Reference in New Issue