diff options
author | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2021-08-05 12:11:39 +0100 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2021-08-06 16:50:09 +0100 |
commit | a7ef7e54fa927bab5b649a8aac6111f02d6ba34f (patch) | |
tree | d8809d89e298d5bad96cf00c9be8a0163e36c05b | |
parent | b46c79278b0715dc34257fdee056f5d50e87dd88 (diff) |
ci: Report failures via email
When an error is detected send a mail report out.
This is currently a hardcoded destination which can
be factored out later.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rwxr-xr-x | common.sh | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -56,12 +56,33 @@ check_version() { fi } +failure_report() { + echo "Subject: $0: $1 has failed" + echo "" + echo "$1 has failed" + echo " --- 8< --- " + cat $2 + echo " --- >8 --- " +} + +SENDMAIL=$(which sendmail) +notify_failures() { + if [ x"$SENDMAIL" == x"" ]; + then + echo "No mail client to notify failures..." + return + fi + + failure_report "$1" "$2" | sendmail kieran.bingham@ideasonboard.com +} + pass_fail() { if [ "$1" -ne 0 ]; then echo " $2: *** Failed ***" if [ -e $logfile ]; then cat $logfile; fi + notify_failures "$2" "$logfile" exit "$1" else echo " $2: Passed" |