diff --git a/infra/build-server/lib.sh b/infra/build-server/lib.sh index de1e7d25c..7e40f442f 100755 --- a/infra/build-server/lib.sh +++ b/infra/build-server/lib.sh @@ -45,7 +45,9 @@ bs_box_state() { # -> "free= slots= load1=" | "absent" | "down" v=$(eval "printf '%s' \"\${BS_ROUTE_STATE_$b:-}\""); if [ -n "$v" ]; then printf '%s' "$v"; return 0; fi f=$(bs_box_file "$b"); [ -s "$f" ] || { printf 'absent'; return 0; } h="$(head -1 "$f" | tr -d '[:space:]')" - ssh "${BS_SSH_OPTS[@]}" -o ConnectTimeout=8 "$h" 'd=/srv/builds/_locks; n=$(cat $d/slots 2>/dev/null || echo 1); free=0; k=0; while [ $k -lt $n ]; do exec 9>>$d/build-$k; if flock -n 9; then free=$((free+1)); fi; exec 9>&-; k=$((k+1)); done; printf "free=%s slots=%s load1=%s" $free $n "$(cut -d" " -f1 /proc/loadavg)"' 2>/dev/null || printf 'down' + # the route check runs before bs_host fills BS_SSH_OPTS; the Mac's bash 3.2 treats the empty array as unbound under + # set -u (every lane on a Mac died here at 13:20Z, 7 October 2026), so the key and the batch options are named here + ssh -i "${BS_KEY:-$HOME/.ssh/igneum_ed25519}" -o BatchMode=yes -o StrictHostKeyChecking=accept-new -o ConnectTimeout=8 "$h" 'd=/srv/builds/_locks; n=$(cat $d/slots 2>/dev/null || echo 1); free=0; k=0; while [ $k -lt $n ]; do exec 9>>$d/build-$k; if flock -n 9; then free=$((free+1)); fi; exec 9>&-; k=$((k+1)); done; printf "free=%s slots=%s load1=%s" $free $n "$(cut -d" " -f1 /proc/loadavg)"' 2>/dev/null || printf 'down' } bs_state_ok() { # -> 0 when the box can take a job now (a free slot, load1 at or under the line) local st="$1" free load