-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#2757 Get the email list from the environment variable MET_CRON_EMAIL…
…_LIST__MET (or MET_CRON_EMAIL_LIST_)
- Loading branch information
Howard Soh
committed
Dec 13, 2023
1 parent
7c6df3c
commit 50bcea9
Showing
1 changed file
with
8 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,9 +20,9 @@ | |
#======================================================================= | ||
|
||
# Constants | ||
#EMAIL_LIST="[email protected] [email protected] [email protected] [email protected] [email protected]" | ||
EMAIL_LIST="[email protected]" | ||
EMAIL_LIST="[email protected]" # overridden by $MET_CRON_EMAIL_LIST_MET or $MET_CRON_EMAIL_LIST | ||
KEEP_DAYS=5 | ||
GIT_REPO_NAME=MET | ||
|
||
function usage { | ||
echo | ||
|
@@ -65,8 +65,12 @@ LOGFILE=${RUN_DIR}/run_sonarqube_${TODAY}.log | |
# Run scan and check for bad return status | ||
${SCRIPT_DIR}/run_sonarqube.sh ${1} > ${LOGFILE} | ||
if [[ $? -ne 0 ]]; then | ||
echo "$0: The nightly SonarQube scan FAILED in `basename ${RUN_DIR}`." >> ${LOGFILE} | ||
cat ${LOGFILE} | mail -s "MET SonarQube scan Failed for ${1} in `basename ${RUN_DIR}` (autogen msg)" ${EMAIL_LIST} | ||
my_cmd="echo \$MET_CRON_EMAIL_LIST_${GIT_REPO_NAME}" | ||
_EMAIL_LIST="$(eval $my_cmd)" | ||
[ -z "$_EMAIL_LIST" ] && _EMAIL_LIST="$MET_CRON_EMAIL_LIST" | ||
[ -z "$_EMAIL_LIST" ] && _EMAIL_LIST="$EMAIL_LIST" | ||
echo "$0: The nightly SonarQube scanning for $GIT_REPO_NAME FAILED in `basename ${RUN_DIR}`." >> ${LOGFILE} | ||
cat ${LOGFILE} | mail -s "$GIT_REPO_NAME SonarQube scanning failed for ${1} in `basename ${RUN_DIR}` (autogen msg)" ${_EMAIL_LIST} | ||
exit 1 | ||
fi | ||
|
||
|