[GH-ISSUE #1513] Is it possible to use the cache action locally? #772

Closed
opened 2026-03-01 21:46:14 +03:00 by kerem · 9 comments
Owner

Originally created by @garyo on GitHub (Dec 18, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1513

Act version

act version 0.2.34

Feature description

I'd like to debug a github actions problem that only happens when using a cache. Is it possible to use the github actions-cache@v3 action locally somehow? When I use it with default settings, I get "[warning]An internal error has occurred in cache backend." and there is no cache hit. I assume this is because it wants to connect to the github cache server?

Originally created by @garyo on GitHub (Dec 18, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1513 ### Act version act version 0.2.34 ### Feature description I'd like to debug a github actions problem that only happens when using a cache. Is it possible to use the github `actions-cache@v3` action locally somehow? When I use it with default settings, I get "[warning]An internal error has occurred in cache backend." and there is no cache hit. I assume this is because it wants to connect to the github cache server?
kerem 2026-03-01 21:46:14 +03:00
Author
Owner

@ChristopherHX commented on GitHub (Dec 18, 2022):

Maybe use this extra software https://github.com/sp-ricard-valverde/github-act-cache-server with act.

I haven't tested it

<!-- gh-comment-id:1356881448 --> @ChristopherHX commented on GitHub (Dec 18, 2022): Maybe use this extra software https://github.com/sp-ricard-valverde/github-act-cache-server with act. _I haven't tested it_
Author
Owner

@brainstorm commented on GitHub (Dec 19, 2022):

Maybe use this extra software https://github.com/sp-ricard-valverde/github-act-cache-server with act.

I haven't tested it

Tested and works, thanks for sharing!:

(...)
[tests/test]   💬  ::debug::Resolved Keys:
[tests/test]   💬  ::debug::["Linux-cargo-cache3-3f42a65b8420df9ab86628f1233b7523c41b76a723b68f452be28c551ca29fad","Linux-cargo-cache3-"]
[tests/test]   💬  ::debug::Checking zstd --version
[tests/test]   💬  ::debug::*** zstd command line interface 64-bits v1.4.8, by Yann Collet ***
[tests/test]   💬  ::debug::Resource Url: http://localhost:8080/_apis/artifactcache/cache?keys=Linux-cargo-cache3-3f42a65b8420df9ab86628f1233b7523c41b76a723b68f452be28c551ca29fad%252CLinux-cargo-cache3-&version=2409070636ec2f8ce3c0c0ad575284d61fcf980b1ef2bb600a95071e5a8efdff
[tests/test]   💬  ::debug::Failed to delete archive: Error: ENOENT: no such file or directory, unlink ''
| Cache not found for input keys: Linux-cargo-cache3-3f42a65b8420df9ab86628f1233b7523c41b76a723b68f452be28c551ca29fad, Linux-cargo-cache3-
[tests/test]   ✅  Success - Main Cargo cache

And on the cache-server-docker log:

Attaching to github-act-cache-server-app-1
github-act-cache-server-app-1  | Cleaning up uncompleted transfers
github-act-cache-server-app-1  | Purging DB
github-act-cache-server-app-1  | Done
github-act-cache-server-app-1  | Listening on port 8080
github-act-cache-server-app-1  | Missing key Linux-cargo-cache3-3f42a65b8420df9ab86628f1233b7523c41b76a723b68f452be28c551ca29fadgithub-act-cache-server-app-1  | Missing key cargo-install-444a40cde2d505c82053

Granted, it doesn't find the cache keys because it is a first run and/or I have the keys misconfigured, but this third party cache daemon allows me to run my Rust CI workflow locally 🎉

<!-- gh-comment-id:1356939604 --> @brainstorm commented on GitHub (Dec 19, 2022): > Maybe use this extra software https://github.com/sp-ricard-valverde/github-act-cache-server with act. > > _I haven't tested it_ Tested and works, thanks for sharing!: ``` (...) [tests/test] 💬 ::debug::Resolved Keys: [tests/test] 💬 ::debug::["Linux-cargo-cache3-3f42a65b8420df9ab86628f1233b7523c41b76a723b68f452be28c551ca29fad","Linux-cargo-cache3-"] [tests/test] 💬 ::debug::Checking zstd --version [tests/test] 💬 ::debug::*** zstd command line interface 64-bits v1.4.8, by Yann Collet *** [tests/test] 💬 ::debug::Resource Url: http://localhost:8080/_apis/artifactcache/cache?keys=Linux-cargo-cache3-3f42a65b8420df9ab86628f1233b7523c41b76a723b68f452be28c551ca29fad%252CLinux-cargo-cache3-&version=2409070636ec2f8ce3c0c0ad575284d61fcf980b1ef2bb600a95071e5a8efdff [tests/test] 💬 ::debug::Failed to delete archive: Error: ENOENT: no such file or directory, unlink '' | Cache not found for input keys: Linux-cargo-cache3-3f42a65b8420df9ab86628f1233b7523c41b76a723b68f452be28c551ca29fad, Linux-cargo-cache3- [tests/test] ✅ Success - Main Cargo cache ``` And on the cache-server-docker log: ``` Attaching to github-act-cache-server-app-1 github-act-cache-server-app-1 | Cleaning up uncompleted transfers github-act-cache-server-app-1 | Purging DB github-act-cache-server-app-1 | Done github-act-cache-server-app-1 | Listening on port 8080 github-act-cache-server-app-1 | Missing key Linux-cargo-cache3-3f42a65b8420df9ab86628f1233b7523c41b76a723b68f452be28c551ca29fadgithub-act-cache-server-app-1 | Missing key cargo-install-444a40cde2d505c82053 ``` Granted, it doesn't find the cache keys because it is a first run and/or I have the keys misconfigured, but this third party cache daemon allows me to run my Rust CI workflow locally 🎉
Author
Owner

@molayodecker commented on GitHub (Mar 1, 2023):

Maybe use this extra software https://github.com/sp-ricard-valverde/github-act-cache-server with act.
I haven't tested it

Tested and works, thanks for sharing!:

(...)
[tests/test]   💬  ::debug::Resolved Keys:
[tests/test]   💬  ::debug::["Linux-cargo-cache3-3f42a65b8420df9ab86628f1233b7523c41b76a723b68f452be28c551ca29fad","Linux-cargo-cache3-"]
[tests/test]   💬  ::debug::Checking zstd --version
[tests/test]   💬  ::debug::*** zstd command line interface 64-bits v1.4.8, by Yann Collet ***
[tests/test]   💬  ::debug::Resource Url: http://localhost:8080/_apis/artifactcache/cache?keys=Linux-cargo-cache3-3f42a65b8420df9ab86628f1233b7523c41b76a723b68f452be28c551ca29fad%252CLinux-cargo-cache3-&version=2409070636ec2f8ce3c0c0ad575284d61fcf980b1ef2bb600a95071e5a8efdff
[tests/test]   💬  ::debug::Failed to delete archive: Error: ENOENT: no such file or directory, unlink ''
| Cache not found for input keys: Linux-cargo-cache3-3f42a65b8420df9ab86628f1233b7523c41b76a723b68f452be28c551ca29fad, Linux-cargo-cache3-
[tests/test]   ✅  Success - Main Cargo cache

And on the cache-server-docker log:

Attaching to github-act-cache-server-app-1
github-act-cache-server-app-1  | Cleaning up uncompleted transfers
github-act-cache-server-app-1  | Purging DB
github-act-cache-server-app-1  | Done
github-act-cache-server-app-1  | Listening on port 8080
github-act-cache-server-app-1  | Missing key Linux-cargo-cache3-3f42a65b8420df9ab86628f1233b7523c41b76a723b68f452be28c551ca29fadgithub-act-cache-server-app-1  | Missing key cargo-install-444a40cde2d505c82053

Granted, it doesn't find the cache keys because it is a first run and/or I have the keys misconfigured, but this third party cache daemon allows me to run my Rust CI workflow locally 🎉

Hi @brainstorm,
Can you please share your cache workflow.
This is what I have and it doesn't work
Looks like the Authorization key is missing

::***::Resource Url: http://***:8080/_apis/artifactcache/cache?keys=Linux-yarn-e8943332524d13b75456a47ad703d0a691233a8b9b4b9a8f7146be54228fb5a2%252CLinux-yarn-&version=84d7b02a61d0b31f347fcddab445d98204dc22e7f42a4366ff8a82ec6de1ae78
[ci/test]   ❓  ::***::getCacheEntry - Attempt 1 of 2 failed with error: connect ECONNREFUSED ::1:8080
[ci/test]   💬  ::***::Resource Url: http://***:8080/_apis/artifactcache/cache?keys=Linux-yarn-e8943332524d13b75456a47ad703d0a691233a8b9b4b9a8f7146be54228fb5a2%252CLinux-yarn-&version=84d7b02a61d0b31f347fcddab445d98204dc22e7f42a4366ff8a82ec6de1ae78
[ci/test]   ❓  ::***::getCacheEntry - Attempt 2 of 2 failed with error: connect ECONNREFUSED ::1:8080
[ci/test]   ❓  ::warning::Failed to restore: getCacheEntry failed: connect ECONNREFUSED ::1:8080
- name: Get yarn cache directory path
  id: yarn-cache-dir-path
  run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- name: Setup yarn cache
  uses: actions/cache@v3
  id: cache-yarn-cache
  with:
      path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
      key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
      restore-keys: |
          ${{ runner.os }}-yarn-
<!-- gh-comment-id:1450660838 --> @molayodecker commented on GitHub (Mar 1, 2023): > > Maybe use this extra software https://github.com/sp-ricard-valverde/github-act-cache-server with act. > > _I haven't tested it_ > > Tested and works, thanks for sharing!: > > ``` > (...) > [tests/test] 💬 ::debug::Resolved Keys: > [tests/test] 💬 ::debug::["Linux-cargo-cache3-3f42a65b8420df9ab86628f1233b7523c41b76a723b68f452be28c551ca29fad","Linux-cargo-cache3-"] > [tests/test] 💬 ::debug::Checking zstd --version > [tests/test] 💬 ::debug::*** zstd command line interface 64-bits v1.4.8, by Yann Collet *** > [tests/test] 💬 ::debug::Resource Url: http://localhost:8080/_apis/artifactcache/cache?keys=Linux-cargo-cache3-3f42a65b8420df9ab86628f1233b7523c41b76a723b68f452be28c551ca29fad%252CLinux-cargo-cache3-&version=2409070636ec2f8ce3c0c0ad575284d61fcf980b1ef2bb600a95071e5a8efdff > [tests/test] 💬 ::debug::Failed to delete archive: Error: ENOENT: no such file or directory, unlink '' > | Cache not found for input keys: Linux-cargo-cache3-3f42a65b8420df9ab86628f1233b7523c41b76a723b68f452be28c551ca29fad, Linux-cargo-cache3- > [tests/test] ✅ Success - Main Cargo cache > ``` > > And on the cache-server-docker log: > > ``` > Attaching to github-act-cache-server-app-1 > github-act-cache-server-app-1 | Cleaning up uncompleted transfers > github-act-cache-server-app-1 | Purging DB > github-act-cache-server-app-1 | Done > github-act-cache-server-app-1 | Listening on port 8080 > github-act-cache-server-app-1 | Missing key Linux-cargo-cache3-3f42a65b8420df9ab86628f1233b7523c41b76a723b68f452be28c551ca29fadgithub-act-cache-server-app-1 | Missing key cargo-install-444a40cde2d505c82053 > ``` > > Granted, it doesn't find the cache keys because it is a first run and/or I have the keys misconfigured, but this third party cache daemon allows me to run my Rust CI workflow locally 🎉 Hi @brainstorm, Can you please share your cache workflow. This is what I have and it doesn't work Looks like the Authorization key is missing ``` ::***::Resource Url: http://***:8080/_apis/artifactcache/cache?keys=Linux-yarn-e8943332524d13b75456a47ad703d0a691233a8b9b4b9a8f7146be54228fb5a2%252CLinux-yarn-&version=84d7b02a61d0b31f347fcddab445d98204dc22e7f42a4366ff8a82ec6de1ae78 [ci/test] ❓ ::***::getCacheEntry - Attempt 1 of 2 failed with error: connect ECONNREFUSED ::1:8080 [ci/test] 💬 ::***::Resource Url: http://***:8080/_apis/artifactcache/cache?keys=Linux-yarn-e8943332524d13b75456a47ad703d0a691233a8b9b4b9a8f7146be54228fb5a2%252CLinux-yarn-&version=84d7b02a61d0b31f347fcddab445d98204dc22e7f42a4366ff8a82ec6de1ae78 [ci/test] ❓ ::***::getCacheEntry - Attempt 2 of 2 failed with error: connect ECONNREFUSED ::1:8080 [ci/test] ❓ ::warning::Failed to restore: getCacheEntry failed: connect ECONNREFUSED ::1:8080 ``` ``` - name: Get yarn cache directory path id: yarn-cache-dir-path run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Setup yarn cache uses: actions/cache@v3 id: cache-yarn-cache with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- ```
Author
Owner

@brainstorm commented on GitHub (Mar 1, 2023):

I don't use this anymore, but my workflows are here: https://github.com/umccr/htsget-rs/

By the error messages, it seems that the cache docker container thing is not up and/or reachable? Sorry I cannot help further :/

<!-- gh-comment-id:1450773159 --> @brainstorm commented on GitHub (Mar 1, 2023): I don't use this anymore, but my workflows are here: https://github.com/umccr/htsget-rs/ By the error messages, it seems that the cache docker container thing is not up and/or reachable? Sorry I cannot help further :/
Author
Owner

@molayodecker commented on GitHub (Mar 1, 2023):

https://github.com/umccr/htsget-rs/

It's reachable but looks like i'm not sending a Authorization token
github.com/sp-ricard-valverde/github-act-cache-server@a9f979f43b/src/index.js (L44)

Thanks for the feedback

<!-- gh-comment-id:1450813048 --> @molayodecker commented on GitHub (Mar 1, 2023): > https://github.com/umccr/htsget-rs/ It's reachable but looks like i'm not sending a Authorization token https://github.com/sp-ricard-valverde/github-act-cache-server/blob/a9f979f43bc2a7a6d233ea6690686bcb25352fe9/src/index.js#L44 Thanks for the feedback
Author
Owner

@michalcs commented on GitHub (Mar 19, 2023):

::***::Resource Url: http://***:8080/_apis/artifactcache/cache?keys=Linux-yarn-e8943332524d13b75456a47ad703d0a691233a8b9b4b9a8f7146be54228fb5a2%252CLinux-yarn-&version=84d7b02a61d0b31f347fcddab445d98204dc22e7f42a4366ff8a82ec6de1ae78
[ci/test]   ❓  ::***::getCacheEntry - Attempt 1 of 2 failed with error: connect ECONNREFUSED ::1:8080
[ci/test]   💬  ::***::Resource Url: http://***:8080/_apis/artifactcache/cache?keys=Linux-yarn-e8943332524d13b75456a47ad703d0a691233a8b9b4b9a8f7146be54228fb5a2%252CLinux-yarn-&version=84d7b02a61d0b31f347fcddab445d98204dc22e7f42a4366ff8a82ec6de1ae78
[ci/test]   ❓  ::***::getCacheEntry - Attempt 2 of 2 failed with error: connect ECONNREFUSED ::1:8080
[ci/test]   ❓  ::warning::Failed to restore: getCacheEntry failed: connect ECONNREFUSED ::1:8080

Same issue here. Can't get the authorisation working , failing on ECONNREFUSED ::1:8080

It's reachable but looks like i'm not sending a Authorization token
github.com/sp-ricard-valverde/github-act-cache-server@a9f979f43b/src/index.js (L44)

I've tried to comment out that if condition and the localhost:8080 now responds with success. But act still throws the same error when running the workflow 🤷

<!-- gh-comment-id:1475077168 --> @michalcs commented on GitHub (Mar 19, 2023): > ``` > ::***::Resource Url: http://***:8080/_apis/artifactcache/cache?keys=Linux-yarn-e8943332524d13b75456a47ad703d0a691233a8b9b4b9a8f7146be54228fb5a2%252CLinux-yarn-&version=84d7b02a61d0b31f347fcddab445d98204dc22e7f42a4366ff8a82ec6de1ae78 > [ci/test] ❓ ::***::getCacheEntry - Attempt 1 of 2 failed with error: connect ECONNREFUSED ::1:8080 > [ci/test] 💬 ::***::Resource Url: http://***:8080/_apis/artifactcache/cache?keys=Linux-yarn-e8943332524d13b75456a47ad703d0a691233a8b9b4b9a8f7146be54228fb5a2%252CLinux-yarn-&version=84d7b02a61d0b31f347fcddab445d98204dc22e7f42a4366ff8a82ec6de1ae78 > [ci/test] ❓ ::***::getCacheEntry - Attempt 2 of 2 failed with error: connect ECONNREFUSED ::1:8080 > [ci/test] ❓ ::warning::Failed to restore: getCacheEntry failed: connect ECONNREFUSED ::1:8080 > ``` Same issue here. Can't get the authorisation working , failing on `ECONNREFUSED ::1:8080` > It's reachable but looks like i'm not sending a Authorization token > https://github.com/sp-ricard-valverde/github-act-cache-server/blob/a9f979f43bc2a7a6d233ea6690686bcb25352fe9/src/index.js#L44 I've tried to comment out that `if` condition and the localhost:8080 now responds with `success`. But `act` still throws the same error when running the workflow 🤷
Author
Owner

@MatteoGioioso commented on GitHub (Apr 12, 2023):

Has anyone managed to make this work? I always have: Cache not found for input keys: mykey, so effectively is not caching

UPDATE: ok, it was not clear from the cache action docs that I have to explicitly save the dependencies:

      - name: Restore cached go deps
        id: cache-godeps-restore
        uses: actions/cache/restore@v3
        with:
          path: ~/go
          key: ${{ runner.os }}-godeps

       # install and build go and do other stuff

      - name: Save go deps
        id: cache-godeps-save
        uses: actions/cache/save@v3
        with:
          path: ~/go
          key: ${{ steps.cache-godeps-restore.outputs.cache-primary-key }}

<!-- gh-comment-id:1504757484 --> @MatteoGioioso commented on GitHub (Apr 12, 2023): Has anyone managed to make this work? I always have: `Cache not found for input keys: mykey`, so effectively is not caching **UPDATE**: ok, it was not clear from the cache action docs that I have to explicitly save the dependencies: ``` - name: Restore cached go deps id: cache-godeps-restore uses: actions/cache/restore@v3 with: path: ~/go key: ${{ runner.os }}-godeps # install and build go and do other stuff - name: Save go deps id: cache-godeps-save uses: actions/cache/save@v3 with: path: ~/go key: ${{ steps.cache-godeps-restore.outputs.cache-primary-key }} ```
Author
Owner

@wolfogre commented on GitHub (May 5, 2023):

Closed by #1770

<!-- gh-comment-id:1535774918 --> @wolfogre commented on GitHub (May 5, 2023): Closed by #1770
Author
Owner

@joeygrisafe-RL commented on GitHub (Sep 26, 2023):

Is this working for anyone using setup-python or setup-node actions?

<!-- gh-comment-id:1736100475 --> @joeygrisafe-RL commented on GitHub (Sep 26, 2023): Is this working for anyone using setup-python or setup-node actions?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#772
No description provided.