Skip to content
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

cache: yarn doesn't work for a self hosted runner #313

Closed
yhaskell opened this issue Aug 6, 2021 · 13 comments
Closed

cache: yarn doesn't work for a self hosted runner #313

yhaskell opened this issue Aug 6, 2021 · 13 comments

Comments

@yhaskell
Copy link

yhaskell commented Aug 6, 2021

In the documentation, there is a section called Caching packages dependencies, which suggests to use cache: yarn for caching yarn dependencies.

On GitHub runners, it works, since GitHub runners have both node and yarn already installed, and therefore there is no problem.
On self-hosted runner, this is not a case.

Which leads us to a catch-22 situation: setup-node action actually expects node to be installed (together with yarn).

Therefore, the action itself fails (since it cannot run yarn during setup).

My proposal is maybe to actually install yarn during the action, at least if we need it for action to success.

Thanks!

@DirkLachowski
Copy link

If you self-host the runner, why not simply install yarn on it?

@yhaskell
Copy link
Author

yhaskell commented Aug 6, 2021

Problem is that yarn is an application that uses node. setup-node installs node. but setup-node cannot install node, because it uses the program that is written in node to do the caching.

@DirkLachowski
Copy link

Maybe i got you wrong, but if you host your own runner, you can install whatever you want so the software is already there before your action starts. Make a vm with a custom image containing node. Only after that, install the github runner sw.

@yhaskell
Copy link
Author

yhaskell commented Aug 7, 2021

So, basically the idea is to not use setup node to set up node on the self hosted runners?

@BeeJayJayn
Copy link

Okay, do we have a solution for this?

Sure we can install it on the self-hosted runners, but the whole error is stupid...

@yhaskell
Copy link
Author

yhaskell commented Sep 2, 2021 via email

@n0mer
Copy link

n0mer commented Sep 12, 2021

@DirkLachowski how would you use multiple versions of node.js? setup-node installs node.js, and it should install yarn as well

@dmitry-shibanov
Copy link
Contributor

Hello everyone! It's an expected behavior. If the runner does not have appropriate tool preinstalled it's expected that caching will fail. Please preinstall yarn to your self-hosted runners by your own.
I'm closing the issue.

@yhaskell
Copy link
Author

Yes, but the problem is that the tool depends on node, which you're taking care of installing!

@yhaskell
Copy link
Author

Basically, I have to install node, to be able to install node. That sounds counterintuitive, and wrong

@gkatsanos
Copy link

@dmitry-shibanov could you kindly make an doc section to explain how self-hosted runners should setup their config so they achieve caching? We're a bit blocked/lost about this. We followed the documention, yet on every new install yarn is re-installing deps.

@DirkLachowski
Copy link

@n0mer By building one image per node version. Pinning your environment is what you want anyway to have reproducible builds.

@paschaldev
Copy link

I came here stuck with this problem in 2023 and it seemed like few people didn't understand what @yhaskell was saying but I do. Still looking for a way out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants