From 3a26334c70543a175a195813097b60d0dc960c6a Mon Sep 17 00:00:00 2001 From: casjay Date: Fri, 16 Oct 2026 10:47:16 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Refresh=20stale=20server=20addre?= =?UTF-8?q?ss=20in=20registered=20runners=20=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Runners registered when the container IP was the default kept that IP in their .runner file. After a restart the IP pointed elsewhere, so every Declare call timed out and no runner could connect. The address is now rewritten to the current server address on each start. - rootfs/usr/local/bin/start-runners: update the address field of an existing .runner to SERVER_ADDRESS when it differs, logging each change - TODO.AI.md: record the cause, the fix and its verification --- TODO.AI.md | 12 ++++++++++++ rootfs/usr/local/bin/start-runners | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/TODO.AI.md b/TODO.AI.md index 4933d10..3c42d90 100644 --- a/TODO.AI.md +++ b/TODO.AI.md @@ -7,6 +7,18 @@ and the container exits 1 (empty days value passed to `openssl req -days`). The file is generated, so the fix belongs in the upstream gen-dockerfile template, then regenerate. +## Fixed — existing runners kept a stale server address and could not reach Gitea (start-runners) + +- `act_runner register` stores the server address in each `reg/runner-N/.runner`, and `start-runners` + skips registration when that file exists. Runners registered before the `127.0.0.1` default (when it + was the container IP) kept e.g. `http://172.17.0.3:80`; after a restart that IP no longer belongs to + Gitea, so every `Declare` call hung until the 60s client timeout (`deadline_exceeded`). +- `start-runners` now rewrites `address` in each existing `.runner` to the current `SERVER_ADDRESS` on + every start (logged as `Updating runner-N server address`). Registration, UUIDs and labels untouched. +- Verified: fresh start of 5 runners, then all 5 `.runner` files forced to `172.17.0.3:80` and the + container recreated on the same volumes: all 5 rewritten to `127.0.0.1:80`, 0 errors, and all 5 listed + online in Gitea's `action_runner` table (last_online seconds ago). + ## Fixed — app.ini migrated for Gitea 28.0.0 (template + startup) - Audited against the Gitea source and the 28.0.0 binary's own startup log. Findings: `[security] diff --git a/rootfs/usr/local/bin/start-runners b/rootfs/usr/local/bin/start-runners index 636fa10..f770769 100755 --- a/rootfs/usr/local/bin/start-runners +++ b/rootfs/usr/local/bin/start-runners @@ -151,6 +151,12 @@ __register_runner() { return 1 fi fi + # .runner stores the server address from registration; a container IP baked in earlier goes stale + # after a restart, so point it at the current SERVER_ADDRESS every start + if [ -f "$runner_dir/.runner" ] && ! grep -q -F -- "\"address\": \"$SERVER_ADDRESS\"" "$runner_dir/.runner"; then + __log "Updating $runner_name server address to $SERVER_ADDRESS" + sed -i "s|\"address\": *\"[^\"]*\"|\"address\": \"$SERVER_ADDRESS\"|" "$runner_dir/.runner" + fi __log "Runner $runner_name registered" } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -