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

Random Yarn cache error "yarn cache is not found" #547

Closed
2 of 5 tasks
neilime opened this issue Jul 21, 2022 · 2 comments
Closed
2 of 5 tasks

Random Yarn cache error "yarn cache is not found" #547

neilime opened this issue Jul 21, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@neilime
Copy link

neilime commented Jul 21, 2022

Description:

In actions/setup-node, we can observe a random behavior on Yarn cache restoration. Sometime we can see the message "yarn cache is not found". Even if a cache has been created in a previous run.

I don't succeed to identify the context to reproduce the issue, despite many attempts.

Action version:
v3.4.1

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:
yarn

Repro steps:

  1. Use this action in a nodejs repository having yarn.lock file
  2. Run the workflow for the first time
  3. Update yarn.lock (by adding a new dependency or updating an existing one)
  4. Push to run the workflow a second time
  5. See the error message "yarn cache is not found"

Example repository: https://github.com/escemi-tech/test-yarn-cache-is-not-found

Expected behavior:
Yarn cache should be restored once it has be created once even is if yarn.lock file has changed

Actual behavior:

Yarn cache is not restored when yarn.lock file has changed

A potential clue

In documentation, it says "The action follows actions/cache guidelines".

For yarn, actions/cache tells to use it as follow:

- uses: actions/cache@v3
  id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  with:
    path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
    key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
    restore-keys: |
      ${{ runner.os }}-yarn-

In

const primaryKey = `node-cache-${platform}-${packageManager}-${fileHash}`;
, it looks like that cache is restored on node-cache-${platform}-${packageManager}-${fileHash} and not on node-cache-${platform}-${packageManager}- as recommended by the documentation.

@neilime neilime added bug Something isn't working needs triage labels Jul 21, 2022
@neilime neilime changed the title Yarn cache is not used when yarn.lock file has changed Random Yarn cache error "yarn cache is not found" Jul 21, 2022
@dmitry-shibanov
Copy link
Contributor

Hello @neilime. Thank you for your report. I think it is an expected behaviour because the setup-node action uses only primary key. For now I'm going to close the issue.

@ArmorDarks
Copy link

@dmitry-shibanov Though, why it's expected behavior, and why not add restore-keys?

deining pushed a commit to deining/setup-node that referenced this issue Nov 9, 2023
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 6.4.1 to 6.7.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.7.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants