From d57d6a359168d42e1ff6c964d207b7ab93194a6d Mon Sep 17 00:00:00 2001 From: Emil Simeonov Date: Mon, 10 Aug 2026 10:34:45 +0200 Subject: [PATCH] fix: use until=1h filter for network prune in critical path The critical disk prune path was doing `docker network prune -f` without a filter, which removes ALL unused networks. This races with Gitea Actions jobs that are mid-startup: the runner creates a network, then the healthcheck prunes it before the container attaches, causing "network not found" errors. Use `--filter "until=1h"` (same as the warn path) to only remove networks older than 1 hour. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../roles/gitea_runner/templates/runner-healthcheck.sh.j2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ansible/roles/gitea_runner/templates/runner-healthcheck.sh.j2 b/ansible/roles/gitea_runner/templates/runner-healthcheck.sh.j2 index 3df68a1..c86528e 100644 --- a/ansible/roles/gitea_runner/templates/runner-healthcheck.sh.j2 +++ b/ansible/roles/gitea_runner/templates/runner-healthcheck.sh.j2 @@ -234,7 +234,10 @@ if [[ "$disk_pct" -ge {{ gitea_runner_healthcheck_disk_critical }} ]]; then | awk '{print $1}' \ | xargs -r docker rm -f 2>/dev/null || true docker system prune -af --volumes || true - docker network prune -f || true + # Prune networks older than 1 hour only — removing ALL networks can + # race with Gitea Actions jobs that are mid-startup (network created + # but container not yet attached), causing "network not found" errors. + docker network prune -f --filter "until=1h" || true docker builder prune -af || true disk_pct=$(df -P / | awk 'NR==2 {gsub(/%/, "", $5); print $5}') echo "INFO: Disk usage after full prune: ${disk_pct}%"