r/forgejo • u/alexdev-tb • 22d ago
What I learned building hosted runners for Forgejo Actions
I have been building hosted runners for Forgejo Actions on my servers in Germany (it’s called Stoke CI, more below, and yes, I run it). Forgejo and forgejo-runner surprised me a few times along the way so here is what I ran into in case it saves someone else the debugging.
- Host mode breaks Rust caching: In host mode, forgejo-runner puts every job in a randomly named directory. rust-cache puts the absolute path of “target/“ into the cache version, so it never restores since the path doesn’t match. I have opened an issue on this in https://code.forgejo.org/forgejo/forgejo-actions-feature-requests/issues/139. Write-up: https://stokeci.dev/blog/host-mode-cache-keys
- Ephemeral runners that never get a job never expire: Forgejo deletes an ephemeral runner after its one job, but one that never got it never gets deleted. Its credentials can be reused, even with different labels so I reuse them instead of piling up dead runners. Notes on this: https://stokeci.dev/blog/ephemeral-forgejo-runners
- A runner that dies mid-job leaves the job “running”: On Forgejo 17.0.1 the job was still marked running after 10+ minutes. The runner stayed listed, so still listed doesn’t mean “still alive”
- An empty job list is “null” not “[]”: Small thing but broke my first parser ( GET /api/v1/…/actions/jobs )
After all these obstacles I ran through, I was still able to make a functional hosted runners platform for Forgejo which I love. Right now I’m looking for bugs so I opened a beta with free signup.
Also surprisingly setting up caches for crates.io and actions caches was easy to do, which I thought would be hard.
Limits on Stoke CI (for beta):
- 2 cores, 4gb, 60 minutes per job( I know, cool right? :) )
- signups are approved by hand ( a fast approval time so it’s not really that much of a limit )
I would really like to know: what you would need before using hosted runners instead of self-hosting them?
https://stokeci.dev
4
u/ad-on-is 22d ago
I happily selfhost my runners.
1
u/nextized 22d ago
Thinking of writing a k8s operator to do ephemeral workers. Nothing concrete yet, but its on my todolist
1
u/SerhiiCho 19d ago
Being able to have your own CI runners (similar to GitHub actions) is the best thing about Forgejo imo. I just love that 1 Orange pi can make it happen
-1
u/c0mndr 22d ago
I had the feeling this post is AI slopped, and https://www.pangram.com confirms, 100% AI slop. Would not use that service