Fix apt-cacher-ng: use working pattern from deb-mock workflow
Some checks failed
Build libfuse / Build and Test (push) Failing after 10s
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:
parent
5194b36968
commit
ccaa7b0fd2
1 changed files with 12 additions and 55 deletions
|
|
@ -30,33 +30,6 @@ jobs:
|
||||||
# Verify files are copied
|
# Verify files are copied
|
||||||
ls -la /workspace/particle-os/libfuse/
|
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
|
- name: Build libfuse in Debian container
|
||||||
run: |
|
run: |
|
||||||
# Run the build directly in Debian container
|
# Run the build directly in Debian container
|
||||||
|
|
@ -68,36 +41,20 @@ jobs:
|
||||||
bash -c '
|
bash -c '
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Install curl first so we can test apt-cacher-ng connectivity
|
# Try apt-cacher-ng first, fallback to Debian's automatic mirror selection
|
||||||
echo "Installing curl first..."
|
echo "Checking for apt-cacher-ng availability..."
|
||||||
apt-get update
|
|
||||||
apt-get install -y curl
|
|
||||||
|
|
||||||
# Configure apt to use cacher if available
|
# Quick check with timeout to avoid hanging
|
||||||
# Try multiple methods to reach the apt-cacher-ng service
|
if timeout 10 curl -s --connect-timeout 5 http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then
|
||||||
APT_CACHER_IP=""
|
echo "✅ apt-cacher-ng is available, configuring proxy sources..."
|
||||||
echo "Testing apt-cacher-ng connectivity..."
|
echo "deb http://192.168.1.101:3142/ftp.debian.org/debian trixie main contrib non-free" > /etc/apt/sources.list
|
||||||
if curl -s http://host.docker.internal:3142/acng-report.html > /dev/null 2>&1; then
|
echo "deb-src http://192.168.1.101:3142/ftp.debian.org/debian trixie main contrib non-free" >> /etc/apt/sources.list
|
||||||
APT_CACHER_IP="host.docker.internal:3142"
|
echo "Using apt-cacher-ng proxy for faster builds"
|
||||||
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"
|
|
||||||
else
|
else
|
||||||
echo "Apt-cacher-ng not accessible, testing direct connection"
|
echo "⚠️ apt-cacher-ng not available or slow, using Debian's automatic mirror selection..."
|
||||||
fi
|
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
|
||||||
if [ -n "$APT_CACHER_IP" ]; then
|
echo "Using httpredir.debian.org for automatic mirror selection"
|
||||||
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"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update and install remaining dependencies
|
# Update and install remaining dependencies
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue