mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-16 06:19:21 +00:00
fix(ci): bound the last unguarded bun installs against a hang
Same defect as #4204/#4206: an erroring bun install (corrupt tarball extraction) can hang instead of exiting, eating a full job timeout. - install-workspace-dependencies.sh: portable bash-only watchdog (no GNU `timeout` on macOS/Windows runners) so its own retry loop can actually fire on a hang. - k8s-jobs/Dockerfile.example: same timeout+retry as the other two fixed Dockerfiles (Debian base, GNU timeout available). - ci.yml: route the bare Windows install step through the now guarded script instead of a raw bun install. Nothing else in this class is left. Claude-Session: https://claude.ai/code/session_018Ne5CfTmFV6GStSKZDf2dy
This commit is contained in:
@@ -4,9 +4,32 @@ set -u
|
||||
|
||||
max_attempts=3
|
||||
retry_delay_seconds="${HF_BUN_INSTALL_RETRY_DELAY_SECONDS:-5}"
|
||||
install_timeout_seconds="${HF_BUN_INSTALL_TIMEOUT_SECONDS:-300}"
|
||||
|
||||
# Portable: this runs on ubuntu/macos/windows(Git Bash), and GNU `timeout`
|
||||
# is not reliably present there (macOS has none by default). A hung bun
|
||||
# install errors then never exits (see fix/regression-docker-build-timeout),
|
||||
# so without this the retry loop below never fires.
|
||||
run_with_timeout() {
|
||||
local seconds=$1
|
||||
shift
|
||||
"$@" &
|
||||
local pid=$!
|
||||
local elapsed=0
|
||||
while kill -0 "$pid" 2>/dev/null; do
|
||||
if ((elapsed >= seconds)); then
|
||||
kill -TERM "$pid" 2>/dev/null
|
||||
wait "$pid" 2>/dev/null
|
||||
return 124
|
||||
fi
|
||||
sleep 1
|
||||
elapsed=$((elapsed + 1))
|
||||
done
|
||||
wait "$pid"
|
||||
}
|
||||
|
||||
for ((attempt = 1; attempt <= max_attempts; attempt += 1)); do
|
||||
if bun install --frozen-lockfile "$@"; then
|
||||
if run_with_timeout "$install_timeout_seconds" bun install --frozen-lockfile "$@"; then
|
||||
exit 0
|
||||
else
|
||||
install_status=$?
|
||||
|
||||
Reference in New Issue
Block a user