-
-
Notifications
You must be signed in to change notification settings - Fork 313
Tool cache path on self-hosted runners can't be hardcoded #242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I believe the code used is below. The hardcoded values match See most recent 'Image Info' run in https://github.com/MSP-Greg/actions-image-testing/actions. Currently is https://github.com/MSP-Greg/actions-image-testing/actions/runs/1492346296, see 'Show ENV' step. Lines 126 to 137 in 471466b
|
This is problematic with self-hosted runners. Two cases:
So, I suppose the code could check for a match in the toolcache at |
Thanks for the explanation, @MSP-Greg 🙏 Here the code checks for a match in the toolcache so I should probably populate the cache manually to make this action working but it would be good to have a configurable parameter that would allow to force installation with |
That certainly seems possible. Question - do they run concurrently/at the same time? If not, could the default toolcache path be a symlink? Not.enough.coffee.yet... |
It is possible (and desirable) that several instances of self-hosted runner work at the same time. As I can see, each instance has its toolcache at |
Short answer is it's unsupported, almost all built Rubies only work if extracted in those paths, because they are built in those paths and can't be moved. If you already built a populated toolcache, then there is probably little point to use this action, except for the bundler cache.
I don't want to add such complexity in this action, but you are free to make your own action / script / look at https://github.com/ruby/ruby-builder
If two jobs run on same machine it would need inter-process locking and that's typically tricky to use, i.e., significant additional complexity that's not for this action. I think being able to use an already-built ruby prefix by specifying an absolute path, or to use the ruby currently in PATH could be an addition which still allows to use bundler caching for such cases with custom toolcaches. If you have a custom toolcache, it's on your own to build ruby in it. |
Hi, @eregon! Thanks for your detailed response 🙏 I understand your position but would like to clarify several things in hope that maybe it could help us find a good solution instead of just closing the issue 😊
The main point for me to use this action is to be able to use both self-hosted and GitHub-hosted runners without having separate workflows/steps (consistency) + the bundler caching.
As I mentioned, there are separate toolcaches for each runner instance so I don't see where would we need inter-process locking as each runner instance able to run one job at a time.
Sure, that is what I have now but I would avoid that for the reasons I mentioned earlier (consistency and simplicity).
I don't have anything custom in my config. I use self-hosted runners that provided by GitHub and I configured them with default values. And GitHub never mentioned that I can't have several instances of it or some other restrictions. |
I missed that, then that locking does not apply, but I still wouldn't want to call If you use a single toolcache for all runners then you could place them in the same location as GH-hosted runners and it'd work.
I meant a new action for "bundler cache" not just
The GitHub docs don't mention it, but as we see here and I guess in other actions there is the expectation that the toolcache is in the same path, otherwise things might break. |
@eregon, isn't it possible to replicate https://github.com/Homebrew/homebrew-portable-ruby and build Ruby in a way it can be moved around the filesystem? Homebrew successfully does it for Linux (amd64) and macOS (amd64 and arm64). It doesn't seem to be too complicated. |
I tried a while ago and it's badly supported and breaks several things, even more on older Rubies: #98 (comment) I'll close this issue. |
With #473 this action now gives instructions for how to make it work for self-hosted runners not matching a GitHub-hosted runner image. So it's kind of close to #242 (comment) (reading it again that's a well-thought comment) except you would need to run ruby-build manually, because it's not that trivial (e.g., need to find which OS packages are needed per OS and since it's self-hosted there is no idea of what is already available, etc) and also if the action did it automatically people would likely be tempted to file an issue here if
There doesn't seem to be a reliable way to detect it, and for self-hosted runners that happen to match a GH-hosted runner image it seems better to reuse precompiled binaries. So what I did is if it's not one of the well-known GH-hosted runner images OS & OS version then it's considered self-hosted. Probably we should also consider self-hosted if the RUNNER_TOOL_CACHE is not the default one, I would consider that the proper solution for this issue. And the configurable parameter is a good idea since there is no way to reliably detect it. |
…sted runner * Fixes ruby#242
…sted runner * Fixes ruby#242
Done now. |
I'll need to revert the detection of different RUNNER_TOOL_CACHE as self-hosted, to fix #475. |
Hi! I use self-hosted runners and I have several instances on the same physical machine. I see that this action uses hardcoded path to tool cache but there is no guarantee that even when people have only one self-hosted runner that it will be
/Users/runner...
. Would it be possible to avoid all path hardcoding?The text was updated successfully, but these errors were encountered: