From 30e4b73c3cd8498e3ed9c3049e9fcea9a0f8d490 Mon Sep 17 00:00:00 2001 From: joe Date: Wed, 13 Aug 2025 20:37:17 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Restore=20apt-cacher-ng=20with?= =?UTF-8?q?=20proper=20timeout=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ✅ Bring back apt-cacher-ng support (as requested) - 🔧 Add timeout 10 to prevent hanging on slow proxy - 🚀 Fallback to httpredir.debian.org if proxy unavailable - 📦 Best of both worlds: proxy speed + reliability - 🎯 Target: Keep apt-cacher-ng without hanging issues --- .forgejo/workflows/ci.yml | 72 ++++++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 12 deletions(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 3397bd71..9b29be68 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -23,9 +23,21 @@ jobs: steps: - name: Setup environment run: | - # Use Debian's automatic mirror selection (much simpler and faster) - echo "deb http://httpredir.debian.org/debian trixie main contrib non-free" > /etc/apt/sources.list - echo "deb-src http://httpredir.debian.org/debian trixie main contrib non-free" >> /etc/apt/sources.list + # Try apt-cacher-ng first, fallback to Debian's automatic mirror selection + echo "Checking for apt-cacher-ng availability..." + + # Quick check with timeout to avoid hanging + if timeout 10 curl -s --connect-timeout 5 http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then + echo "✅ apt-cacher-ng is available, configuring proxy sources..." + echo "deb http://192.168.1.101:3142/ftp.debian.org/debian trixie main contrib non-free" > /etc/apt/sources.list + echo "deb-src http://192.168.1.101:3142/ftp.debian.org/debian trixie main contrib non-free" >> /etc/apt/sources.list + echo "Using apt-cacher-ng proxy for faster builds" + else + echo "⚠️ apt-cacher-ng not available or slow, using Debian's automatic mirror selection..." + echo "deb http://httpredir.debian.org/debian trixie main contrib non-free" > /etc/apt/sources.list + echo "deb-src http://httpredir.debian.org/debian trixie main contrib non-free" >> /etc/apt/sources.list + echo "Using httpredir.debian.org for automatic mirror selection" + fi # APT Performance Optimizations (2-3x faster) echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/99translations @@ -204,9 +216,21 @@ jobs: steps: - name: Setup environment run: | - # Use Debian's automatic mirror selection (much simpler and faster) - echo "deb http://httpredir.debian.org/debian trixie main contrib non-free" > /etc/apt/sources.list - echo "deb-src http://httpredir.debian.org/debian trixie main contrib non-free" >> /etc/apt/sources.list + # Try apt-cacher-ng first, fallback to Debian's automatic mirror selection + echo "Checking for apt-cacher-ng availability..." + + # Quick check with timeout to avoid hanging + if timeout 10 curl -s --connect-timeout 5 http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then + echo "✅ apt-cacher-ng is available, configuring proxy sources..." + echo "deb http://192.168.1.101:3142/ftp.debian.org/debian trixie main contrib non-free" > /etc/apt/sources.list + echo "deb-src http://192.168.1.101:3142/ftp.debian.org/debian trixie main contrib non-free" >> /etc/apt/sources.list + echo "Using apt-cacher-ng proxy for faster builds" + else + echo "⚠️ apt-cacher-ng not available or slow, using Debian's automatic mirror selection..." + echo "deb http://httpredir.debian.org/debian trixie main contrib non-free" > /etc/apt/sources.list + echo "deb-src http://httpredir.debian.org/debian trixie main contrib non-free" >> /etc/apt/sources.list + echo "Using httpredir.debian.org for automatic mirror selection" + fi apt update -y @@ -239,9 +263,21 @@ jobs: steps: - name: Setup environment run: | - # Use Debian's automatic mirror selection (much simpler and faster) - echo "deb http://httpredir.debian.org/debian trixie main contrib non-free" > /etc/apt/sources.list - echo "deb-src http://httpredir.debian.org/debian trixie main contrib non-free" >> /etc/apt/sources.list + # Try apt-cacher-ng first, fallback to Debian's automatic mirror selection + echo "Checking for apt-cacher-ng availability..." + + # Quick check with timeout to avoid hanging + if timeout 10 curl -s --connect-timeout 5 http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then + echo "✅ apt-cacher-ng is available, configuring proxy sources..." + echo "deb http://192.168.1.101:3142/ftp.debian.org/debian trixie main contrib non-free" > /etc/apt/sources.list + echo "deb-src http://192.168.1.101:3142/ftp.debian.org/debian trixie main contrib non-free" >> /etc/apt/sources.list + echo "Using apt-cacher-ng proxy for faster builds" + else + echo "⚠️ apt-cacher-ng not available or slow, using Debian's automatic mirror selection..." + echo "deb http://httpredir.debian.org/debian trixie main contrib non-free" > /etc/apt/sources.list + echo "deb-src http://httpredir.debian.org/debian trixie main contrib non-free" >> /etc/apt/sources.list + echo "Using httpredir.debian.org for automatic mirror selection" + fi apt update -y @@ -290,9 +326,21 @@ jobs: steps: - name: Setup environment run: | - # Use Debian's automatic mirror selection (much simpler and faster) - echo "deb http://httpredir.debian.org/debian trixie main contrib non-free" > /etc/apt/sources.list - echo "deb-src http://httpredir.debian.org/debian trixie main contrib non-free" >> /etc/apt/sources.list + # Try apt-cacher-ng first, fallback to Debian's automatic mirror selection + echo "Checking for apt-cacher-ng availability..." + + # Quick check with timeout to avoid hanging + if timeout 10 curl -s --connect-timeout 5 http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then + echo "✅ apt-cacher-ng is available, configuring proxy sources..." + echo "deb http://192.168.1.101:3142/ftp.debian.org/debian trixie main contrib non-free" > /etc/apt/sources.list + echo "deb-src http://192.168.1.101:3142/ftp.debian.org/debian trixie main contrib non-free" >> /etc/apt/sources.list + echo "Using apt-cacher-ng proxy for faster builds" + else + echo "⚠️ apt-cacher-ng not available or slow, using Debian's automatic mirror selection..." + echo "deb http://httpredir.debian.org/debian trixie main contrib non-free" > /etc/apt/sources.list + echo "deb-src http://httpredir.debian.org/debian trixie main contrib non-free" >> /etc/apt/sources.list + echo "Using httpredir.debian.org for automatic mirror selection" + fi apt update -y apt install -y --no-install-recommends git