Self-Hosted Runner Autoscaling Automation Prompt
Design autoscaling for self-hosted GitHub Actions runners — webhook-driven scale-up, idle scale-down, and ephemeral runner lifecycle — so CI capacity tracks demand without leaving zombie runners or leaking credentials between jobs.
- Target user
- Platform engineers running self-hosted CI runner fleets
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior platform engineer who has run self-hosted CI runner fleets and learned that a non-ephemeral runner is a security incident waiting to inherit the last job's secrets. I will provide: - The runner platform (Actions Runner Controller on K8s, VM autoscaling group, etc.) - The job demand pattern (burst times, queue depth, average job duration) - The trigger source (workflow_job webhooks, queue metrics, schedule) - Cost and security constraints (max fleet size, isolation requirements) Your job: 1. **Scaling signal** — choose the scale-up trigger (`workflow_job` queued webhooks vs polled queue depth) and explain the latency/accuracy trade-off for the demand pattern given. 2. **Ephemeral lifecycle** — design runners as single-use: register, run one job, deregister, and destroy, so no state or secret survives into the next job. 3. **Scale-down logic** — define idle detection, a cooldown to avoid thrash, and how to drain a runner mid-job-safe (never kill a runner executing a job). 4. **Capacity bounds** — set min/max fleet size, per-label pools, and a hard ceiling so a webhook storm or fork-PR abuse cannot scale the fleet unbounded. 5. **Registration tokens and secrets** — handle short-lived registration tokens, scope runner permissions to least privilege, and keep org/repo secrets out of the runner image. 6. **Failure handling** — define behavior for failed registration, stuck runners, and orphaned cloud resources, including a reaper that cleans up leaks. 7. **Observability and cost** — list metrics (queue wait, runner utilization, scale events, orphan count) to alert on starvation and to track cost per job. Output as: an architecture diagram description, the scale-up/scale-down decision logic, the ephemeral runner lifecycle, the capacity-bound config, and the reaper/cleanup plan. Require ephemeral single-use runners, a hard max-fleet ceiling, and a reaper for orphans, with scale-down that never interrupts a running job.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
GitHub Actions Reusable Ops Workflow Library Design Prompt
Design a library of reusable GitHub Actions workflows and composite actions for common ops tasks (deploy, rollback, secret rotation, scheduled checks) with pinned versions, scoped permissions, and inputs/outputs so teams stop copy-pasting drifting YAML across dozens of repos.
-
Auto-Scaling Cost vs Latency Tuning Prompt
Tune auto-scaling parameters to balance cost against latency and reliability, choosing the right metrics, thresholds, and cooldowns to avoid flapping and over-provisioning.
-
Auto-Scaling Policy Automation Prompt
Design data-driven auto-scaling policies for HPA, KEDA, or cloud ASGs — picking the right metrics, thresholds, stabilization windows, and guardrails to avoid flapping and runaway scale-up.
-
Automation Client-Side Rate Limiter Token Bucket Design Prompt
Design a client-side rate limiter for automation that calls external APIs, using a token-bucket to stay under provider quotas, absorb bursts, and coordinate limits across concurrent workers without tripping 429s.
More Automation prompts & error guides
Browse every Automation prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.