351ed2fc24a13b86cf2a1fc9695309e2c0da9de5
lrnassar
  Wed Jun 3 09:33:28 2026 -0700
Make otto fetch failures loud and clinGen silent on no-update. refs #37697

Several otto jobs used 'wget -q'/'curl -s' under 'set -e', so a broken download
aborted with no output and cron (which mails on output, not exit code) sent nothing
-- the mode by which mastermind failed silently for months.

- mastermind, malacards: add an ERR trap that echoes a failure message; switch
mastermind's 'curl -s' to 'curl -sf' so an HTTP error fails loudly instead of
writing a challenge page into the release file.
- geneReviews: add an ERR trap (kept silent on no-update via the wrapper's mail -E).
- All three use 'set -eE' (errtrace) so the ERR trap also fires for failures inside
functions/subshells, not just top-level commands.
- clinGen: capture each sub-build's exit status instead of swallowing it under
'set +e', and report which sub-build failed. Also drop the routine 'No ... update'
echoes and the unconditional 'ClinGen update done.' line, and switch the wrapper to
'mail -E', so clinGen is now silent on no-update and only emails on a real update
or a failure.

diff --git src/hg/utils/otto/geneReviews/checkGeneReviews.sh src/hg/utils/otto/geneReviews/checkGeneReviews.sh
index 95f2da74183..d89adfb632f 100755
--- src/hg/utils/otto/geneReviews/checkGeneReviews.sh
+++ src/hg/utils/otto/geneReviews/checkGeneReviews.sh
@@ -1,75 +1,82 @@
 #!/bin/sh -e
 
 #	Do not modify this script, modify the source tree copy:
 #	src/utils/geneReviews/checkGeneReviews.sh
 #	This script is used via a cron job and kept in $HOME/bin/scripts/
 
 #	cron jobs need to ensure this is true
 #       current login requires the user be chinhli
 umask 002
 
 WORKDIR=$1
 export WORKDIR
 
+# Emit an error line on any failure so the wrapper's "mail -E" sends an alert. The
+# wget -q is silent and set -e (from the #!/bin/sh -e shebang) would otherwise abort
+# with no output, which mail -E suppresses entirely. set -E (errtrace) makes the ERR
+# trap fire for failures inside functions too. No-update runs stay silent.
+set -E
+trap 'echo "ERROR: GeneReviews build failed (exit $?)"' ERR
+
 function installGeneReviewTables() {
 for i in `cat ../geneReviews.tables`
     do
     n=$i"New"
     o=$i"Old"
     hgsqlSwapTables $1 $n $i $o -dropTable3
     done
     echo "GENEREVIEWS Installed `date` in $1"
 }
 
 
 #	this is where we are going to work
 if [ ! -d "${WORKDIR}" ]; then
     echo "ERROR in GENEREVIEWS release watch, Can not find the directory:
     ${WORKDIR}" 
     exit 255
 fi
 
 cd "${WORKDIR}"
 wget -q --timestamping ftp://ftp.ncbi.nih.gov/pub/GeneReviews/*.txt
 chmod 660 *.txt
 if test NBKid_shortname_genesymbol.txt -nt lastUpdate
 then
     today=`date +%F`
     mkdir -p $today
     mv *.txt $today
 
     cd $today
 
     # build the new GENEREVIEWS track tables
     ../buildGeneReviews.sh
     ../validateGeneReviews.sh hg38
     ../validateGeneReviews.sh hg19
     ../validateGeneReviews.sh hg18
     # now install
     installGeneReviewTables "hg38"  
     installGeneReviewTables "hg19"    
     installGeneReviewTables "hg18"
     # now archive
     for db in "hg18" "hg19" "hg38"
     do
         if [ ! -d ${WORKDIR}/archive/${db} ]; then
             mkdir -p ${WORKDIR}/archive/${db}
         fi
         cd ${WORKDIR}/archive/${db}
         mkdir ${today}
         cd ${today}
         printf "This directory contains a backup of the geneReviews track built on %s" "${today}" > README 
         for i in `cat ${WORKDIR}/geneReviews.tables`
         do
             hgsql -Ne "show create table ${i}" ${db} > ${i}.sql
             hgsql -Ne "select * from ${i}" ${db} | gzip >  ${i}.txt.gz
         done
     done
     cd ${WORKDIR}/${today}
 
     rm -f ../lastUpdate
     cp -p NBKid_shortname_genesymbol.txt ../lastUpdate
 
 fi
 
 exit 0