From 019bc140d7bd7258e11831d61ff45b2bb8f5957d Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Tue, 24 Feb 2026 22:52:28 +0100 Subject: [PATCH] fix(ci): increase idle timeout to 60min, check act_runner children The 15min timeout was too short for Rust builds. Also checks for act_runner child processes (image pull, git clone phases) not just Docker containers. Co-Authored-By: Claude Opus 4.6 --- infra/modules/ci-runner/cloud-init.yaml.tpl | 15 +++++++++++++-- infra/modules/ci-runner/variables.tf | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/infra/modules/ci-runner/cloud-init.yaml.tpl b/infra/modules/ci-runner/cloud-init.yaml.tpl index b8459ade7..4a5457d5c 100644 --- a/infra/modules/ci-runner/cloud-init.yaml.tpl +++ b/infra/modules/ci-runner/cloud-init.yaml.tpl @@ -63,12 +63,23 @@ write_files: IDLE_FILE="/tmp/ci-idle-since" TIMEOUT_SEC=$((${idle_timeout_minutes} * 60)) - RUNNING=$(docker ps -q --filter "name=GITEA-ACTIONS" 2>/dev/null | wc -l) - if [ "$RUNNING" -gt 0 ]; then + # Check for running Docker containers + CONTAINERS=$(docker ps -q 2>/dev/null | wc -l) + if [ "$CONTAINERS" -gt 0 ]; then rm -f "$IDLE_FILE" exit 0 fi + # Check if act_runner has child processes (actively running a job) + RUNNER_PID=$(pgrep -f 'act_runner daemon' 2>/dev/null) + if [ -n "$RUNNER_PID" ]; then + CHILDREN=$(pgrep -P "$RUNNER_PID" 2>/dev/null | wc -l) + if [ "$CHILDREN" -gt 0 ]; then + rm -f "$IDLE_FILE" + exit 0 + fi + fi + # No jobs running — record when idle started if [ ! -f "$IDLE_FILE" ]; then date +%s > "$IDLE_FILE" diff --git a/infra/modules/ci-runner/variables.tf b/infra/modules/ci-runner/variables.tf index 89bf5dcaf..b1c66eec4 100644 --- a/infra/modules/ci-runner/variables.tf +++ b/infra/modules/ci-runner/variables.tf @@ -65,7 +65,7 @@ variable "runner_capacity" { variable "idle_timeout_minutes" { description = "Minutes idle before auto-shutdown (0 = disabled)" type = number - default = 15 + default = 60 } variable "gitea_tailscale_host" {