Fix apt-cacher-ng: use working pattern from deb-mock workflow
Some checks failed
Build libfuse / Build and Test (push) Failing after 10s

- Replace complex apt-cacher-ng setup with proven working pattern
- Use direct IP address (192.168.1.101:3142) like in deb-mock workflow
- Remove separate apt-cacher-ng container setup step
- Use sources.list configuration instead of apt proxy configuration
- This matches the working pattern from apt-ostree and deb-mock workflows

The previous approach was too complex and not working. This uses
the exact same pattern that works in your other CI workflows.
This commit is contained in:
robojerk 2025-09-07 17:30:48 -07:00
parent 5194b36968
commit ccaa7b0fd2

View file

@ -30,33 +30,6 @@ jobs:
# Verify files are copied
ls -la /workspace/particle-os/libfuse/
- name: Setup apt-cacher-ng
run: |
echo "Setting up apt-cacher-ng for faster builds..."
# Stop any existing apt-cacher-ng container
echo "Stopping any existing apt-cacher-ng containers..."
docker stop apt-cacher-ng 2>/dev/null || echo "No existing container to stop"
docker rm apt-cacher-ng 2>/dev/null || echo "No existing container to remove"
# Start apt-cacher-ng in background with proper network configuration
echo "Starting apt-cacher-ng container..."
docker run -d --name apt-cacher-ng --network host sameersbn/apt-cacher-ng:latest || echo "Apt-cacher-ng failed to start"
# Check if container is running
echo "Checking if apt-cacher-ng container is running..."
docker ps | grep apt-cacher-ng || echo "Apt-cacher-ng container not found in running containers"
# Wait for it to be ready
echo "Waiting for apt-cacher-ng to be ready..."
timeout 30 bash -c 'until curl -s http://localhost:3142/acng-report.html > /dev/null 2>&1; do sleep 2; done' || echo "Apt-cacher-ng not ready, continuing without cache"
# Test the connection
if curl -s http://localhost:3142/acng-report.html > /dev/null 2>&1; then
echo "Apt-cacher-ng is ready and accessible"
else
echo "Apt-cacher-ng is not accessible, will use direct connection"
fi
- name: Build libfuse in Debian container
run: |
# Run the build directly in Debian container
@ -68,36 +41,20 @@ jobs:
bash -c '
set -e
# Install curl first so we can test apt-cacher-ng connectivity
echo "Installing curl first..."
apt-get update
apt-get install -y curl
# Try apt-cacher-ng first, fallback to Debian's automatic mirror selection
echo "Checking for apt-cacher-ng availability..."
# Configure apt to use cacher if available
# Try multiple methods to reach the apt-cacher-ng service
APT_CACHER_IP=""
echo "Testing apt-cacher-ng connectivity..."
if curl -s http://host.docker.internal:3142/acng-report.html > /dev/null 2>&1; then
APT_CACHER_IP="host.docker.internal:3142"
echo "Found apt-cacher-ng at host.docker.internal:3142"
elif curl -s http://172.17.0.1:3142/acng-report.html > /dev/null 2>&1; then
APT_CACHER_IP="172.17.0.1:3142"
echo "Found apt-cacher-ng at 172.17.0.1:3142"
elif curl -s http://host-gateway:3142/acng-report.html > /dev/null 2>&1; then
APT_CACHER_IP="host-gateway:3142"
echo "Found apt-cacher-ng at host-gateway:3142"
# 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 accessible, testing direct connection"
fi
if [ -n "$APT_CACHER_IP" ]; then
echo "Configuring apt to use cacher at $APT_CACHER_IP"
echo "Acquire::http::Proxy \"http://$APT_CACHER_IP\";" > /etc/apt/apt.conf.d/01proxy
echo "Acquire::https::Proxy \"http://$APT_CACHER_IP\";" >> /etc/apt/apt.conf.d/01proxy
echo "Acquire::http::Proxy::security.debian.org \"DIRECT\";" >> /etc/apt/apt.conf.d/01proxy
echo "Acquire::http::Proxy::deb.debian.org \"DIRECT\";" >> /etc/apt/apt.conf.d/01proxy
else
echo "Apt-cacher-ng not available, using direct connection"
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://deb.debian.org/debian trixie main contrib non-free" >> /etc/apt/sources.list
echo "Using httpredir.debian.org for automatic mirror selection"
fi
# Update and install remaining dependencies