Skip to content

Commit 2ddbf3e

Browse files
authored
fix(ci): bound and retry the e2e browser system package install (#10693)
* fix(ci): bound and retry the e2e browser system package install * fix(ci): bound the dpkg recovery between browser package attempts
1 parent 98e4ff7 commit 2ddbf3e

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

‎.github/scripts/install-playwright.sh‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
# The dependency dry run uses the pinned driver's package list without updating apt.
33
set -euo pipefail
44

5+
# A healthy apt install takes under a minute. A stalled mirror download otherwise holds the
6+
# install, and with it the whole suite step's budget, with no output: apt's inactivity timeout
7+
# misses a download that trickles. Each retry resumes apt's partial downloads.
8+
DEPS_ATTEMPT_SECONDS=120
9+
DEPS_ATTEMPTS=3
10+
511
browsers=()
612
for argument in "$@"; do
713
case "$argument" in
@@ -11,6 +17,20 @@ for argument in "$@"; do
1117
done
1218

1319
if ! bunx --no-install playwright install-deps --dry-run "${browsers[@]}"; then
14-
bunx --no-install playwright install-deps "${browsers[@]}"
20+
for attempt in $(seq "$DEPS_ATTEMPTS"); do
21+
if timeout --kill-after=15 "$DEPS_ATTEMPT_SECONDS" \
22+
bunx --no-install playwright install-deps "${browsers[@]}"; then
23+
break
24+
fi
25+
if [ "$attempt" -eq "$DEPS_ATTEMPTS" ]; then
26+
echo "::error::Browser system packages did not install in $DEPS_ATTEMPTS attempts." >&2
27+
exit 1
28+
fi
29+
echo "Browser system package install attempt $attempt failed or stalled; retrying." >&2
30+
# An attempt cut off while dpkg was unpacking leaves it interrupted, which blocks the retry.
31+
if ! timeout --kill-after=15 "$DEPS_ATTEMPT_SECONDS" sudo dpkg --configure -a; then
32+
echo "Browser system package recovery failed or stalled; retrying anyway." >&2
33+
fi
34+
done
1535
fi
1636
exec bunx --no-install playwright install "$@"

0 commit comments

Comments
 (0)