toolkit icon indicating copy to clipboard operation
toolkit copied to clipboard

feat: allow passing custom `ACTIONS_CACHE_URL`

Open LouisHaftmann opened this issue 2 years ago β€’ 10 comments

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

LouisHaftmann avatar Mar 26 '24 16:03 LouisHaftmann

@robherley, @bethanyj28 would you mind taking a look at this?

edigaryev avatar Mar 29 '24 07:03 edigaryev

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.

LouisHaftmann avatar Apr 17 '24 05:04 LouisHaftmann

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

LouisHaftmann avatar Apr 30 '24 06:04 LouisHaftmann

@robherley @bethanyj28

fingerart avatar May 24 '24 10:05 fingerart

Would be great to have this option! It is hard to overwrite the cache url in self-hosted runners currently.

breezewish avatar Jul 18 '24 08:07 breezewish

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.

fkorotkov avatar Jul 18 '24 12:07 fkorotkov

Patching the binary also works, but it’s frustrating not to be able to do it correctly. It's such a small patch..

Tycale avatar Jul 18 '24 12:07 Tycale

I'm beginning to feel like only Github staff contributions are welcome in this repo πŸ₯²

LouisHaftmann avatar Jul 18 '24 12:07 LouisHaftmann

I tried contacting a staff member via email to review this PR. Fingers crossed! 🀞🏻

Tycale avatar Jul 18 '24 12:07 Tycale

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

enescakir avatar Jul 31 '24 18:07 enescakir