Files
orca/.github/scripts/install-ubuntu-apt-packages.sh
Neil f820fdf8d4 ci: fail over unavailable Ubuntu package mirrors (#41174)
* ci: fail over unavailable Ubuntu package mirrors

* fix(ci): recover package retries across headless jobs

* fix(ci): allow complete fallback package index downloads

* fix(ci): recover dpkg locks and bound WebKit setup retries

* fix(ci): run apt deadlines inside sudo sessions

* fix(ci): invoke installed Playwright without root pnpm

* fix(ci): allow large fallback dependency downloads to finish
2026-11-11 08:30:55 -08:00

29 lines
1.1 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
if [ "$#" -eq 0 ]; then
echo 'Usage: install-ubuntu-apt-packages.sh <package>...' >&2
exit 2
fi
bash "$(dirname "${BASH_SOURCE[0]}")/prepare-ubuntu-apt.sh"
# Bound both routes while allowing large fallback downloads.
# Run deadlines as root so sudo cannot leave apt in a separate session.
if sudo timeout --kill-after=10s 45 apt-get update -o Acquire::Languages=none && sudo timeout --kill-after=10s 120 apt-get install -y "$@"; then
exit 0
fi
echo 'Ubuntu package setup failed; trying the same packages through the MIT mirror.' >&2
for host in archive.ubuntu.com ports.ubuntu.com mirrors.mit.edu; do
timeout 5 getent ahosts "$host" || true
done
bash "$(dirname "${BASH_SOURCE[0]}")/use-ubuntu-apt-mirror.sh"
bash "$(dirname "${BASH_SOURCE[0]}")/recover-ubuntu-dpkg.sh" || true
# Unrelated repositories may fail refresh; apt still verifies the requested packages.
if ! sudo timeout --kill-after=10s 120 apt-get update -o Acquire::Languages=none; then
echo 'Index refresh incomplete; attempting the requested packages with available authenticated indexes.' >&2
fi
sudo timeout --kill-after=10s 600 apt-get install -y "$@"