act: actions/cache@v2 error: Cache Service Url not found, unable to restore cache

I am not sure how the cache is meant to work with nektos/act, but when working around bug #257, the cache will always throw a cache-hit=false with the following errors:

☁  git clone 'https://github.com/actions/cache' # ref=v2
🐳  docker cp src=/home/grische/.cache/act/actions-cache@v2 dst=/actions/
❓   ::save-state name=CACHE_KEY::Linux-2b7ee04efeb2a8c4ea27558750b1c2dee27f1692a30af56727638c98655a2410
💬  ::debug::Resolved Keys:
💬  ::debug::["Linux-2b7ee04efeb2a8c4ea27558750b1c2dee27f1692a30af56727638c98655a2410"]
💬  ::debug::Checking zstd --version
💬  ::debug::*** zstd command line interface 64-bits v1.3.3, by Yann Collet ***
💬  ::debug::getCacheEntry - Attempt 1 of 2 failed with error: Cache Service Url not found, unable to restore cache.
💬  ::debug::getCacheEntry - Attempt 2 of 2 failed with error: Cache Service Url not found, unable to restore cache.
| [warning]getCacheEntry failed: Cache Service Url not found, unable to restore cache.
⚙  ::set-output:: cache-hit=false

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 50
  • Comments: 15 (2 by maintainers)

Commits related to this issue

Most upvoted comments

If you are using nektos/act to develop GHA workflows locally and want to get actions/cache working so that you can get faster feedback when you test-run on your changes to GHA workflow yaml files;

  1. #329 is a dead end. Do not bother reading the long thread.
    • It is mostly about artifact upload/download actions, not cache actions.
  2. Disable cache actions with if: ${{ !env.ACT }}
  3. Use act’s --reuse flag.

I will repeat that last step, because it is a much better solution than trying to get the cache action working locally;

Use act’s --reuse flag

From the docs; -r, --reuse reuse action containers to maintain state

Cache saving and restoring becomes unnecessary.

Issue is stale and will be closed in 7 days unless there is new activity

Google search suggestions and results suggest that this is a popular topic and issue;

image

image

  1. Use act’s --reuse flag.

I will repeat that last step, because it is a much better solution than trying to get the cache action working locally;

As @netaskd as informed us, this only works if each job has the same jobs.{id}.name: value, which, as you may expect, not ideal. It would be nice if --reuse reused the container for the whole workflow.

It seems --reuse keys on jobs.{id}.name for reuse.

@BevanR in this case we have to set name: field the same for each jobs, that uses actions/cache. Otherwise it does not work…

I guess this can be tracked as part of #329

Any progress on this? seems to be linked to #329