refactor: pull cache server management out of runner #1373

Merged
mfenniak merged 2 commits from mfenniak/forgejo-runner:multiconnection-cache-server into main 2026-02-13 19:55:05 +00:00
Owner

When NewRunner is invoked, it creates a Runner which does client-specific configuration -- environment variables GITHUB_SERVER_URL, ACTIONS_RUNTIME_URL, and ACTIONS_RESULTS_URL are all different based upon the connection address to the remote client. If we're going to support multiple connections to different servers, we're going to need multiple runners with these different environments. NewRunner also creates the cache server.

This PR pulls the cache server creation out of NewRunner so that multiple runners could be created.

  • other
    • PR: refactor: pull cache server management out of runner
When `NewRunner` is invoked, it creates a `Runner` which does client-specific configuration -- environment variables `GITHUB_SERVER_URL`, `ACTIONS_RUNTIME_URL`, and `ACTIONS_RESULTS_URL` are all different based upon the connection address to the remote client. If we're going to support multiple connections to different servers, we're going to need multiple runners with these different environments. `NewRunner` also creates the cache server. This PR pulls the cache server creation out of `NewRunner` so that multiple runners could be created. <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - other - [PR](https://code.forgejo.org/forgejo/runner/pulls/1373): <!--number 1373 --><!--line 0 --><!--description cmVmYWN0b3I6IHB1bGwgY2FjaGUgc2VydmVyIG1hbmFnZW1lbnQgb3V0IG9mIHJ1bm5lcg==-->refactor: pull cache server management out of runner<!--description--> <!--end release-notes-assistant-->
refactor: pull cache server mgmt out of runner
Some checks failed
issue-labels / release-notes (pull_request_target) Successful in 8s
checks / validate pre-commit-hooks file (pull_request) Successful in 35s
checks / Build Forgejo Runner (pull_request) Successful in 40s
checks / validate mocks (pull_request) Successful in 46s
checks / Build unsupported platforms (pull_request) Successful in 30s
checks / runner exec tests (pull_request) Successful in 36s
checks / integration tests (docker-latest) (pull_request) Failing after 9m39s
checks / integration tests (docker-stable) (pull_request) Failing after 11m42s
b86773193c
mfenniak changed title from refactor: pull cache server mgmt out of runner to refactor: pull cache server management out of runner 2026-02-13 03:15:49 +00:00
mfenniak force-pushed multiconnection-cache-server from b86773193c
Some checks failed
issue-labels / release-notes (pull_request_target) Successful in 8s
checks / validate pre-commit-hooks file (pull_request) Successful in 35s
checks / Build Forgejo Runner (pull_request) Successful in 40s
checks / validate mocks (pull_request) Successful in 46s
checks / Build unsupported platforms (pull_request) Successful in 30s
checks / runner exec tests (pull_request) Successful in 36s
checks / integration tests (docker-latest) (pull_request) Failing after 9m39s
checks / integration tests (docker-stable) (pull_request) Failing after 11m42s
to cedd332924
Some checks failed
cascade / debug (pull_request_target) Has been skipped
cascade / forgejo (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 7s
checks / validate pre-commit-hooks file (pull_request) Successful in 33s
checks / Build Forgejo Runner (pull_request) Successful in 38s
checks / validate mocks (pull_request) Successful in 40s
checks / Build unsupported platforms (pull_request) Successful in 16s
checks / runner exec tests (pull_request) Successful in 35s
checks / integration tests (docker-stable) (pull_request) Failing after 12m43s
checks / integration tests (docker-latest) (pull_request) Failing after 10m17s
2026-02-13 03:28:56 +00:00
Compare
mfenniak force-pushed multiconnection-cache-server from cedd332924
Some checks failed
cascade / debug (pull_request_target) Has been skipped
cascade / forgejo (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 7s
checks / validate pre-commit-hooks file (pull_request) Successful in 33s
checks / Build Forgejo Runner (pull_request) Successful in 38s
checks / validate mocks (pull_request) Successful in 40s
checks / Build unsupported platforms (pull_request) Successful in 16s
checks / runner exec tests (pull_request) Successful in 35s
checks / integration tests (docker-stable) (pull_request) Failing after 12m43s
checks / integration tests (docker-latest) (pull_request) Failing after 10m17s
to 5252141855
Some checks failed
cascade / end-to-end (pull_request_target) Has been skipped
cascade / forgejo (pull_request_target) Has been skipped
cascade / debug (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 7s
checks / validate pre-commit-hooks file (pull_request) Successful in 42s
checks / validate mocks (pull_request) Successful in 51s
checks / Build Forgejo Runner (pull_request) Successful in 1m42s
checks / Build unsupported platforms (pull_request) Successful in 40s
checks / runner exec tests (pull_request) Successful in 54s
checks / integration tests (docker-latest) (pull_request) Failing after 9m52s
checks / integration tests (docker-stable) (pull_request) Failing after 11m55s
2026-02-13 03:58:44 +00:00
Compare
aahlenst approved these changes 2026-02-13 12:52:21 +00:00
@ -76,2 +73,2 @@
} else {
cacheProxy = nil
if cacheProxy != nil {
envs["ACTIONS_CACHE_URL"] = cacheProxy.ExternalURL()
Member

Is there an advantage to passing the entire handler to NewRunner if only the external URL is necessary? I see that typing is better (unless you can pass net.URL), but it needs a mock during testing.

Is there an advantage to passing the entire handler to `NewRunner` if only the external URL is necessary? I see that typing is better (unless you can pass `net.URL`), but it needs a mock during testing.
Author
Owner

The URL isn't the only usage -- the cacheProxy is stored on the runner, and it is used to register new runs with the proxy when they start.

The URL isn't the only usage -- the `cacheProxy` is stored on the runner, and it is used to register new runs with the proxy when they start.
Member

Sometimes, I don't see things that stare me in the face 🤦

Sometimes, I don't see things that stare me in the face 🤦
aahlenst marked this conversation as resolved
refactor: close artifactcache when closing cacheproxy, if running internal server
All checks were successful
checks / Build Forgejo Runner (pull_request) Successful in 24s
checks / validate pre-commit-hooks file (pull_request) Successful in 30s
checks / validate mocks (pull_request) Successful in 38s
checks / Build unsupported platforms (pull_request) Successful in 23s
checks / runner exec tests (pull_request) Successful in 34s
checks / integration tests (docker-latest) (pull_request) Successful in 9m4s
checks / integration tests (docker-stable) (pull_request) Successful in 11m0s
issue-labels / release-notes (pull_request_target) Successful in 3s
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Successful in 4s
cascade / forgejo (pull_request_target) Successful in 1m8s
b717875be4
Contributor

cascading-pr updated at actions/setup-forgejo#885

cascading-pr updated at https://code.forgejo.org/actions/setup-forgejo/pulls/885
mfenniak deleted branch multiconnection-cache-server 2026-02-13 19:55:06 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo/runner!1373
No description provided.