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

Failure to restore cache Cannot mkdir: Permission denied #503

Closed
2 of 5 tasks
riffraff opened this issue Jun 1, 2022 · 6 comments
Closed
2 of 5 tasks

Failure to restore cache Cannot mkdir: Permission denied #503

riffraff opened this issue Jun 1, 2022 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@riffraff
Copy link

riffraff commented Jun 1, 2022

Description:
This seems like another instance of #362, but it's happening with github-hosted runners, and using yarn instead of npm, and actions/setup-node@v3 instead of v2.

At some point, the cache seems to have been corrupted, and now it fails on multiple PRs.

The java setup action also seems to have a similar issue #459 but I can't guess if it's related.

Action version:
actions/setup-node@v3

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:
node v12.22.12
yarn v1.22.17

Repro steps:

This is happening in a private repo, whenever the action runs.
It might have started happening after I tried to bump the ancient node version used there in a specific PR, but affecting unrelated ones.

The job is straightforward

  unit_tests:
    name: 'Unit tests'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Setup node
        uses: actions/setup-node@v3
        with:
          node-version: '${{ env.NODE_VERSION }}'
          cache: 'yarn'
      - uses: webfactory/ssh-agent@v0.5.0
        with:
          ssh-private-key: ${{ my-key }}
      - name: Install dependencies
        run: yarn install --ignore-optional --frozen-lockfile --non-interactive
      - run: |
          yarn test:ci

Expected behavior:

Cache is either restored or the job works as if there was a cache miss

Actual behavior:
The job fails. Notice cache size is super tiny, which seems an indication that something else went wrong, but an invalid value is being propagated.

...
Cache Size: ~0 MB (388620 B)
/usr/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/90ebc24d-4768-41bb-8796-16cffd952c1c/cache.tzst -P -C /home/runner/work/my-repo/my-repo
/usr/bin/tar: ../../../../home: Cannot mkdir: Permission denied
/usr/bin/tar: ../../../../home/runner/.cache/yarn/v6: Cannot mkdir: No such file or directory
/usr/bin/tar: ../../../../home: Cannot mkdir: Permission denied
/usr/bin/tar: ../../../../home/runner/.cache/yarn/v6/npm-tslib-2.4.0-7cecaa7f073ce680a05847aa77be941098f36dc3-integrity: Cannot mkdir: No such file or directory
/usr/bin/tar: ../../../../home: Cannot mkdir: Permission denied
....
@riffraff riffraff added bug Something isn't working needs triage labels Jun 1, 2022
@IvanZosimov
Copy link
Contributor

Hi, @riffraff 👋 Thanks for this issue! We'll take it under investigation and get back to you with updates.

@IvanZosimov IvanZosimov self-assigned this Jun 1, 2022
@IvanZosimov
Copy link
Contributor

Hi, @riffraff 👋 I think you encountered an internal issue with GitHub Actions itself, it means that at some step of caching procedure your cache becomes corrupted. Here I can suggest updating the key for your cache, for that you can make some minor changes in the yarn.lock file. As the cache key is updated the new cache entry will be saved and the action will start to work as expected.

@riffraff
Copy link
Author

riffraff commented Jun 2, 2022

thanks @IvanZosimov I worked around it that way, and then by disabling the cache for the time being, because it happened a couple times already, and in our current setup it does not grant a major boost (once we migrate to pnp it would be better).

Still, It would be nice if the setup_node action (or the underlying cache action) would treat the failure to restore a cache as a cache miss, maybe you can consider that as a possible enhancement.

@IvanZosimov
Copy link
Contributor

IvanZosimov commented Jun 2, 2022

Thank you for your suggestion, @riffraff, we will definitely investigate how to solve this issue! ❤️

@IvanZosimov
Copy link
Contributor

@riffraff, I'm going to close this issue now. If you have any other questions or comments feel free to ping me!

deining pushed a commit to deining/setup-node that referenced this issue Nov 9, 2023
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
@kopax-polyconseil
Copy link

@riffraff, I'm going to close this issue now. If you have any other questions or comments feel free to ping me!

I have a question, why is this closed without explanation please? I am trying to cache ~/.cache/yarn and just hit the same error.

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