From fcf9d4b59bbd09ae126d017ebc31c7f466cb557a Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 11 Dec 2025 19:40:25 +0100 Subject: [PATCH] **Aur builder: add retry logic for yay clone to recover from GitHub 504 errors** Implemented a robust retry mechanism for cloning the yay AUR helper during Arch dependency installation. The new logic retries the git clone operation for up to 5 minutes with a 20-second pause between attempts, allowing the build to proceed even when GitHub intermittently returns HTTP 504 errors. This improves the stability of Arch container builds, especially under network pressure or transient upstream outages. The yay build process now only starts once the clone step completes successfully. https://chatgpt.com/share/693b102b-fdb0-800f-9f2e-d4840f14d329 --- .../installation/arch/aur-builder-setup.sh | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/scripts/installation/arch/aur-builder-setup.sh b/scripts/installation/arch/aur-builder-setup.sh index 52c6b4a..e24fdd0 100755 --- a/scripts/installation/arch/aur-builder-setup.sh +++ b/scripts/installation/arch/aur-builder-setup.sh @@ -45,8 +45,42 @@ else fi echo "[aur-builder-setup] Ensuring yay is installed for aur_builder..." + if ! "${RUN_AS_AUR[@]}" 'command -v yay >/dev/null 2>&1'; then - "${RUN_AS_AUR[@]}" 'cd ~ && rm -rf yay && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si --noconfirm' + echo "[aur-builder-setup] yay not found – starting retry sequence for download..." + + MAX_TIME=300 # 5 minutes + SLEEP_INTERVAL=20 # 20 seconds + ELAPSED=0 + + while true; do + if "${RUN_AS_AUR[@]}" ' + set -euo pipefail + cd ~ + rm -rf yay || true + git clone https://aur.archlinux.org/yay.git yay + '; then + echo "[aur-builder-setup] yay repository cloned successfully." + break + fi + + echo "[aur-builder-setup] git clone failed (likely 504). Retrying in ${SLEEP_INTERVAL}s..." + sleep "${SLEEP_INTERVAL}" + ELAPSED=$((ELAPSED + SLEEP_INTERVAL)) + + if (( ELAPSED >= MAX_TIME )); then + echo "[aur-builder-setup] ERROR: Aborted after 5 minutes of retry attempts." + exit 1 + fi + done + + # Now build yay after successful clone + "${RUN_AS_AUR[@]}" ' + set -euo pipefail + cd ~/yay + makepkg -si --noconfirm + ' + else echo "[aur-builder-setup] yay already installed." fi