actions / setup-node

Set up your GitHub Actions workflow with a specific version of node.js
MIT License
3.95k stars 1.31k forks source link

action does not cache on runner or cache server #1156

Open phk-nord opened 3 weeks ago

phk-nord commented 3 weeks ago

Description: We have a self hosted runner (ARC Runner Scale Set) and self hosted actions cache both running in k8s. The action won't cache yarn on either the runner or the cache server

Action version:

Platform:

Runner type:

Tools version:

installed on runner image via nvm:

action uses:

Repro steps:
A description with steps to reproduce the issue. If you have a public example or repo to share, please provide the link.

Expected behavior: A description of what you expected to happen. action caches yarn on the cache server

Actual behavior: A description of what is actually happening. yarn will not be cached.

Action output of the action step

Run actions/setup-node@v4
  with:
    node-version: [2](https://github.com/nordeck/matrix-neoboard-standalone/actions/runs/11589506017/job/32389313057#step:4:2)0
    cache: yarn
    cache-dependency-path: matrix-neoboard-standalone/yarn.lock
  matrix-neoboard/yarn.lock

    always-auth: false
    check-latest: false
    token: ***
  env:
    ARGOCD_SHA: 
    DOCKER_IMAGE: ghcr.io/nordeck/matrix-neoboard-standalone
    REACT_APP_REACT_SDK_VERSION: unset
    REACT_APP_REACT_SDK_REVISION: unset
Found in cache @ /home/runner/_work/_tool/node/20.18.0/x6[4](https://github.com/nordeck/matrix-neoboard-standalone/actions/runs/11589506017/job/32389313057#step:4:4)
Environment details
  node: v20.18.0
  npm: 10.8.2
  yarn: 1.22.22
/home/runner/.nvm/versions/node/v22.7.0/bin/yarn --version
/home/runner/.nvm/versions/node/v22.7.0/bin/yarn --version
1.22.22
/home/runner/.nvm/versions/node/v22.7.0/bin/yarn cache dir
1.22.22
/home/runner/.nvm/versions/node/v22.7.0/bin/yarn cache dir
/home/runner/.cache/yarn/v[6](https://github.com/nordeck/matrix-neoboard-standalone/actions/runs/11589506017/job/32389313057#step:4:6)
/home/runner/.cache/yarn/v6
/home/runner/.nvm/versions/node/v22.[7](https://github.com/nordeck/matrix-neoboard-standalone/actions/runs/11589506017/job/32389313057#step:4:7).0/bin/yarn config get enableGlobalCache
/home/runner/.nvm/versions/node/v22.7.0/bin/yarn config get enableGlobalCache
undefined
undefined
yarn cache is not found
mahabaleshwars commented 3 weeks ago

Hello @phk-nord, Thank you for creating this issue. We will investigate it and provide feedback as soon as we have some updates.

mahabaleshwars commented 1 week ago

Hello @phk-nord,

Could you please share a repro link or detailed steps to reproduce the issue? I reviewed the output you provided and noticed that the action is using Node v20.18.0 while Yarn is being checked in Node v22.7.0. The command yarn cache dir is returning undefined, which suggests that the Yarn cache directory is not set or found. This typically indicates a misconfiguration or that the environment setup is incomplete, causing Yarn to be unable to locate the cache directory.