36fbb0bc581f5189dddc2c2a68aea11a378ad8fc
braney
  Wed Jun 17 06:54:40 2026 -0700
prevent docker image build failure when one mirror is down by adding curl timeouts and || true to the genome vs genome-euro latency check in browserSetup.sh, refs #37780

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

diff --git src/product/installer/browserSetup.sh src/product/installer/browserSetup.sh
index 8cffe928317..28552311d18 100755
--- src/product/installer/browserSetup.sh
+++ src/product/installer/browserSetup.sh
@@ -1649,32 +1649,34 @@
        echo2 Adapting mysql socket locations in $APACHEDIR/cgi-bin/hg.conf
        sed -i "/socket=/s/^/#/" $CGIBINDIR/hg.conf
        sed -i "/^hgc\./s/.usr.lib.gmt.bin/\/usr\/bin/" $CGIBINDIR/hg.conf
     elif [ "$DIST" == "OSX" ]; then
        # in OSX adapt the sockets
        # note that the sed -i syntax is different from linux
        echo2 Adapting mysql socket locations in $CGIBINDIR/hg.conf
        sockFile=`mysql -NBe 'show variables like "socket"' | cut -f2`
        $SEDINPLACE "s|^#?socket=.*|socket=$sockFile|" $CGIBINDIR/hg.conf
        $SEDINPLACE "s|^#?customTracks.socket.*|customTracks.socket=$sockFile|" $CGIBINDIR/hg.conf
        $SEDINPLACE "s|^#?db.socket.*|db.socket=$sockFile|" $CGIBINDIR/hg.conf
        $SEDINPLACE "s|^#?central.socket.*|central.socket=$sockFile|" $CGIBINDIR/hg.conf
     fi
     # check if UCSC or genome-euro MySQL server is closer
     echo comparing latency: genome.ucsc.edu Vs. genome-euro.ucsc.edu
-    eurospeed=$( (time -p (for i in `seq 10`; do curl -sSI genome-euro.ucsc.edu > /dev/null; done )) 2>&1 | grep real | cut -d' ' -f2 )
-    ucscspeed=$( (time -p (for i in `seq 10`; do curl -sSI genome.ucsc.edu > /dev/null; done )) 2>&1 | grep real | cut -d' ' -f2 )
+    # --connect-timeout/--max-time keep an unreachable site from blocking the build, and the || true keeps
+    # its failure (curl exit 28 under set -e) from aborting the install: a down site just loses the latency race
+    eurospeed=$( (time -p (for i in `seq 10`; do curl --connect-timeout 3 --max-time 5 -sSI genome-euro.ucsc.edu > /dev/null || true; done )) 2>&1 | grep real | cut -d' ' -f2 )
+    ucscspeed=$( (time -p (for i in `seq 10`; do curl --connect-timeout 3 --max-time 5 -sSI genome.ucsc.edu > /dev/null || true; done )) 2>&1 | grep real | cut -d' ' -f2 )
     if [[ $(awk '{if ($1 <= $2) print 1;}' <<< "$eurospeed $ucscspeed") -eq 1 ]]; then
        echo genome-euro seems to be closer
        echo modifying hg.conf to pull MariaDB data from genome-euro-mysql instead of genome
        $SEDINPLACE s/slow-db.host=genome-mysql.soe.ucsc.edu/slow-db.host=genome-euro-mysql.soe.ucsc.edu/ $CGIBINDIR/hg.conf
        #$SEDINPLACE "s#gbdbLoc2=http://hgdownload.soe.ucsc.edu/gbdb/#gbdbLoc2=http://hgdownload-euro.soe.ucsc.edu/gbdb/#" $CGIBINDIR/hg.conf
        #HGDOWNLOAD=hgdownload-euro.soe.ucsc.edu
     else
        echo genome.ucsc.edu seems to be closer
        echo not modifying $CGIBINDIR/hg.conf
     fi
 
     # download the CGIs
     if [[ "$OS" == "OSX" ]]; then
         #setupCgiOsx
         echo2 Running on OSX, assuming that CGIs are already built into /usr/local/apache/cgi-bin