Fix apt-cacher-ng configuration for build container
Some checks failed
Build libfuse / Build and Test (push) Failing after 1m27s

- Use --network host for apt-cacher-ng to ensure accessibility
- Try multiple connection methods (host.docker.internal, 172.17.0.1, host-gateway)
- Use correct port 3142 instead of 3143
- Add proper cleanup and testing of apt-cacher-ng service
- This should resolve udev dependency installation issues

The build container was unable to reach apt-cacher-ng, causing
udev package installation to fail and meson configuration to fail.
This commit is contained in:
robojerk 2025-09-07 17:16:58 -07:00
parent 7fc8faa3bc
commit b7f7b1bbf2

View file

@ -33,11 +33,23 @@ jobs:
- name: Setup apt-cacher-ng - name: Setup apt-cacher-ng
run: | run: |
echo "Setting up apt-cacher-ng for faster builds..." echo "Setting up apt-cacher-ng for faster builds..."
# Start apt-cacher-ng in background # Stop any existing apt-cacher-ng container
docker run -d --name apt-cacher-ng -p 3143:3142 sameersbn/apt-cacher-ng:latest || echo "Apt-cacher-ng already running or failed to start" docker stop apt-cacher-ng 2>/dev/null || true
docker rm apt-cacher-ng 2>/dev/null || true
# Start apt-cacher-ng in background with proper network configuration
docker run -d --name apt-cacher-ng --network host sameersbn/apt-cacher-ng:latest || echo "Apt-cacher-ng failed to start"
# Wait for it to be ready # Wait for it to be ready
timeout 30 bash -c 'until curl -s http://localhost:3143/acng-report.html > /dev/null 2>&1; do sleep 2; done' || echo "Apt-cacher-ng not ready, continuing without cache" 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 - name: Build libfuse in Debian container
run: | run: |
@ -51,10 +63,20 @@ jobs:
set -e set -e
# Configure apt to use cacher if available # Configure apt to use cacher if available
if curl -s http://host.docker.internal:3143/acng-report.html > /dev/null 2>&1; then # Try multiple methods to reach the apt-cacher-ng service
echo "Configuring apt to use cacher" APT_CACHER_IP=""
echo "Acquire::http::Proxy \"http://host.docker.internal:3143\";" > /etc/apt/apt.conf.d/01proxy if curl -s http://host.docker.internal:3142/acng-report.html > /dev/null 2>&1; then
echo "Acquire::https::Proxy \"http://host.docker.internal:3143\";" >> /etc/apt/apt.conf.d/01proxy APT_CACHER_IP="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"
elif curl -s http://host-gateway:3142/acng-report.html > /dev/null 2>&1; then
APT_CACHER_IP="host-gateway:3142"
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::security.debian.org \"DIRECT\";" >> /etc/apt/apt.conf.d/01proxy
echo "Acquire::http::Proxy::deb.debian.org \"DIRECT\";" >> /etc/apt/apt.conf.d/01proxy echo "Acquire::http::Proxy::deb.debian.org \"DIRECT\";" >> /etc/apt/apt.conf.d/01proxy
else else