chore: add provider-agnostic bootstrap (#1377)

This commit is contained in:
Carlos Florêncio
2026-06-14 22:05:49 +01:00
committed by GitHub
parent 828385be2a
commit d6cf4a1acc
6 changed files with 273 additions and 20 deletions
+28 -5
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# install-playwright-browsers.sh — install Playwright chromium browser
# install-playwright-browsers.sh — install Playwright chromium browser artifacts
# with a workaround for Firecracker VMs where Node.js io_uring-based
# zip extraction hangs indefinitely.
#
@@ -14,8 +14,30 @@ TIMEOUT_SECS=90
cd "$(dirname "$0")/../apps"
# Check if browsers are already fully installed
if pnpm --filter @kandev/web exec playwright install chromium --dry-run 2>&1 | grep -q "already installed"; then
PW_ARGS=(chromium chromium-headless-shell)
missing=1
found=0
if dry_run="$(pnpm --filter @kandev/web exec playwright install --dry-run "${PW_ARGS[@]}" 2>&1)"; then
missing=0
while IFS= read -r loc; do
[ -n "$loc" ] || continue
found=1
if [ ! -f "$loc/INSTALLATION_COMPLETE" ]; then
missing=1
break
fi
done < <(printf '%s\n' "$dry_run" | awk -F'Install location:[[:space:]]*' 'NF > 1 {print $2}' | sort -u)
if [ "$found" -eq 0 ]; then
missing=1
fi
else
echo "[playwright] dry-run failed; continuing with browser installation"
fi
if [ "$missing" -eq 0 ]; then
echo "[playwright] browsers already installed"
exit 0
fi
@@ -25,7 +47,7 @@ pnpm --filter @kandev/web exec playwright install-deps chromium 2>/dev/null || t
# Attempt normal install with timeout
rm -rf "$PW_CACHE/__dirlock"
if timeout "$TIMEOUT_SECS" pnpm --filter @kandev/web exec playwright install chromium 2>&1; then
if timeout "$TIMEOUT_SECS" pnpm --filter @kandev/web exec playwright install "${PW_ARGS[@]}" 2>&1; then
echo "[playwright] install completed normally"
exit 0
fi
@@ -42,7 +64,8 @@ for comp_dir in "$PW_CACHE"/chromium-* "$PW_CACHE"/chromium_headless_shell-* "$P
[ -f "$comp_dir/INSTALLATION_COMPLETE" ] && continue
comp_name=$(basename "$comp_dir" | sed 's/-[0-9]*$//')
zipfile=$(find /tmp -name "playwright-download-${comp_name}-*" -type f 2>/dev/null | sort | tail -1)
comp_name_alt=${comp_name//_/-}
zipfile=$(find /tmp \( -name "playwright-download-${comp_name}-*" -o -name "playwright-download-${comp_name_alt}-*" \) -type f 2>/dev/null | sort | tail -1)
if [ -z "$zipfile" ]; then
echo "[playwright] no zip found for $comp_name — skipping"