Make the notification email more friendly 43/52443/7
authorThanh Ha <thanh.ha@linuxfoundation.org>
Wed, 1 Mar 2017 03:43:21 +0000 (22:43 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Wed, 1 Mar 2017 16:53:14 +0000 (11:53 -0500)
Improve the messaging to provide more details in the body of the email.
Also reorganize the code to keep the email variable construction
together.

Change-Id: I18aa3a13ff2905354e4b3e10189da157aa0d64d8
Also-by: Anil Belur <abelur@linuxfoundation.org>
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
jjb/autorelease/include-raw-autorelease-notify-build-failure.sh

index 448544674072c3251d26742aba28929208860a22..7cf565d5e897f8160f4be49d6667e4a8cee1258a 100644 (file)
@@ -14,15 +14,6 @@ ARCHIVES_DIR="$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER"
 CONSOLE_LOG="/tmp/autorelease-build.log"
 STREAM=${JOB_NAME#*-*e-}
 
-BODY="Please refer to the logs server URL for console logs when possible
-and use the Jenkins Build URL as a last resort.
-
-Console Logs URL:
-https://logs.opendaylight.org/$SILO/$ARCHIVES_DIR
-
-Jenkins Build URL:
-$BUILD_URL"
-
 # get console logs
 wget -O $CONSOLE_LOG ${BUILD_URL}consoleText
 
@@ -50,6 +41,27 @@ else
     ARTIFACTID=`echo ${REACTOR_INFO} | awk '{ gsub(/^[ \t]+|[ \t]+$/, ""); print }'`
 fi
 
+# Construct email subject & body
+PROJECT_STRING=${PROJECT:+" from $PROJECT"}
+SUBJECT="[release] Autorelease $STREAM failed to build $ARTIFACTID$PROJECT_STRING"
+BODY="Attention$PROJECT_STRING,
+
+Autorelease $STREAM failed to build $ARTIFACTID$PROJECT_STRING in build
+$BUILD_NUMBER. Attached is a snippet of the error message related to the
+failure that we were able to automatically parse as well as console logs.
+
+Console Logs:
+https://logs.opendaylight.org/$SILO/$ARCHIVES_DIR
+
+Jenkins Build:
+$BUILD_URL
+
+Please review and provide an ETA on when a fix will be available.
+
+Thanks,
+ODL releng/autorelease team
+"
+
 # check if remote staging is complete successfully
 BUILD_STATUS=`awk '/\[INFO\] Remote staging finished/{flag=1;next} \
                    /Total time:/{flag=0}flag' $CONSOLE_LOG \
@@ -62,14 +74,10 @@ if [ ! -z "${ARTIFACTID}" ] && [[ "${BUILD_STATUS}" != "SUCCESS" ]]; then
     sed -e "/\[INFO\] Building \(${ARTIFACTID} \|${ODL} :: ${PROJECT} :: ${ARTIFACTID} \)/,/Reactor Summary:/!d;//d" \
           $CONSOLE_LOG > /tmp/error_msg
 
-    if [ -z "${PROJECT}" ]; then
-        PROJECT=${ARTIFACTID}
-    else
+    if [ -n "${PROJECT}" ]; then
         RELEASE_EMAIL="${RELEASE_EMAIL}, ${PROJECT}-dev@opendaylight.org"
     fi
 
-    SUBJECT="[release] Autorelease ${STREAM} build failure: ${PROJECT}"
-
     echo "${BODY}" | mail -a /tmp/error_msg -s "${SUBJECT}" "${RELEASE_EMAIL}"
 fi