]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
Added autotest mail script.
authorMarjan Schiller <marjan.schiller@profitbricks.com>
Wed, 12 Jun 2013 14:42:04 +0000 (16:42 +0200)
committerMarjan Schiller <marjan.schiller@profitbricks.com>
Wed, 12 Jun 2013 14:42:04 +0000 (16:42 +0200)
autotest_result_mail.sh [new file with mode: 0755]

diff --git a/autotest_result_mail.sh b/autotest_result_mail.sh
new file mode 100755 (executable)
index 0000000..3709c76
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+# copyright 2012-2013 Holger Levsen <holger@layer-acht.org>
+# GPL2 licenced
+
+set -e
+#set -x
+export
+echo
+
+#
+# check if mail should be sent
+#
+if [ ${AUTOTEST_SEND_RESULT_MAIL} == "false" ]; then
+        echo "No result mail will be send."
+fi
+
+#
+# check if we have a LIVEBOOT_BUILD_NUMBER
+#
+if [ "$LIVEBOOT_BUILD_NUMBER" != "" ] ; then
+       echo "Ok, got LIVEBOOT_BUILD_NUMBER=$LIVEBOOT_BUILD_NUMBER, which is valid."
+else 
+       echo "Fail, no LIVEBOOT_BUILD_NUMBER set."
+       exit 1
+fi
+
+if [ "$AUTOTEST_MAIL_CONTENT" != "" ] ; then
+        echo "Ok, got AUTOTEST_MAIL_CONTENT."
+else
+        echo "Fail, no LIVEBOOT_BUILD_NUMBER set."
+        exit 1
+fi
+
+# Replace the place holders
+BUILD_NUMBER_TOKEN="<BUILD_NUMBER>"
+MAIL_CONTENT=`echo ${$AUTOTEST_MAIL_CONTENT//$BUILD_NUMBER_TOKEN/$LIVEBOOT_BUILD_NUMBER}`
+
+echo $MAIL_CONTENT
+exit 0
+
+#
+# send announcement mail
+#
+cat $MAIL_CONTENT | /usr/sbin/sendmail -t
+echo
+echo "Ok, announcement mail sent."
+
+#
+# finish
+#
+figlet Ok
+