Skip to content

Commit

Permalink
#2757 Get the email list from the environment variable MET_CRON_EMAIL…
Browse files Browse the repository at this point in the history
…_LIST__MET (or MET_CRON_EMAIL_LIST)
  • Loading branch information
Howard Soh committed Dec 13, 2023
1 parent 51883fd commit 216b2f5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions internal/scripts/sonarqube/run_nightly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
#=======================================================================

# Constants
#EMAIL_LIST="johnhg@ucar.edu hsoh@ucar.edu jpresto@ucar.edu linden@ucar.edu mccabe@ucar.edu"
EMAIL_LIST="hsoh@ucar.edu"
EMAIL_LIST="hsoh@ucar.edu" # overridden by $MET_CRON_EMAIL_LIST_MET or $MET_CRON_EMAIL_LIST
KEEP_DAYS=5
GIT_REPO_NAME=MET

function usage {
echo
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 216b2f5

Please sign in to comment.