feat: allow passing custom `ACTIONS_CACHE_URL`
Closes #1051
Currently it is not possible to overwrite the ACTIONS_CACHE_URL which is used for communicating with the cache api. The ACTIONS_CACHE_URL is always overwritten by the runner itself (runner code snippet).
Being able to overwrite this environment variable is crucial for using the actions/cache action with self-hosted runners, as it allows for a self-hosted caching solution.
To set a custom ACTIONS_CACHE_URL, you just need to define the CUSTOM_ACTIONS_CACHE_URL (open for naming suggestions) env var, which takes precedence over the default cache url env var.
Self-hosting an actions cache server is a much requested feature and this PR would make that way easier.
Other issues/discussions:
- https://github.com/orgs/community/discussions/18549
- https://github.com/github/docs/issues/2271
- https://github.com/actions/runner/pull/3411
@robherley, @bethanyj28 would you mind taking a look at this?
Any feedback on this PR? Is there something I should implement differently or something missing? I will gladly do anything to get this PR merged.
Here are some more PRs mentioning the same issue: #947 #679
Would be great to have this feature! I don't see any real problem or security risk with this. Am I missing something? Would there be a safer way to allow for overwriting the cache server url?
Please let me know π @robherley @bethanyj28
@robherley @bethanyj28
Would be great to have this option! It is hard to overwrite the cache url in self-hosted runners currently.
In the meantime we created a simple fork that patches compiled JavaScript in dist folder of actions/cache to allow overriding ACTIONS_CACHE_URL.
See here how to run it with your own implementation of the Caching API.
Patching the binary also works, but itβs frustrating not to be able to do it correctly. It's such a small patch..
I'm beginning to feel like only Github staff contributions are welcome in this repo π₯²
I tried contacting a staff member via email to review this PR. Fingers crossed! π€π»
I've submitted a PR to introduce a similar feature into the runner script. I hope one of them merges. https://github.com/actions/runner/pull/3411