In cache@v1, the step would fail to create the cache:
Post job cleanup.
/bin/tar -cz -f /home/runner/work/_temp/2a248b52-7c16-40d2-99f3-7385c4e6783a/cache.tgz -C /home/runner/.nuget/packages .
/bin/tar: /home/runner/.nuget/packages: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
[warning]Tar failed with error: The process '/bin/tar' failed with exit code 2
But in cache@v2, it creates an empty tar file:
Post job cleanup.
/bin/tar --use-compress-program zstd -T0 -cf cache.tzst -P -C /home/runner/work/cache-test/cache-test --files-from manifest.txt
Cache saved successfully
Which then results in extracting the empty tar:
Run actions/cache@v2
Cache Size: ~0 MB (22 B)
/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/f096b41b-1e38-4cd8-a7be-ead81367a21b/cache.tzst -P -C /home/runner/work/cache-test/cache-test
Cache restored from key: Linux-nuget--v2
Also note that when there are no matches for hashFiles, it fills in with an empty string. I believe it used to fail with an error when hashFiles failed to match anything.
Also note that when there are no matches for hashFiles, it fills in with an empty string. I believe it used to fail with an error when hashFiles failed to match anything.
We could file a separate issue for this in the runner repo, but I believe there were issues previously when hashFiles failed the step for non-existing files
Sorry for the drive by, but wanted to give this one a light +1.
Upgrading to cache@v2 caused my build to fail, but in a fairly non-obvious way. Based on the Cache Size: ~0 MB (22 B) message (and thanks to this issue!), I was able to localize it a problem with the cache not being populated with anything, but even right now, it's not clear to me why that's the case — I double-, triple-, and quadruple-checked my paths, and there's nothing obviously wrong.
Of course this is still suggestive of a problem on my end, but this would have been a lot faster to diagnose and debug if the cache action complained loudly if it determined an input path did not exist.
Hi! I just want to point out that I am also having this issue with cache@v2.
I have some jobs that can generate a cache or not, if there is no cache, the plugin is caching an empty folder. My job also uses hashFiles, and because it didn't change, the cache has being restored with size 0 MB, making my job resolve the dependencies again and not saving a new cache with all dependencies resolved.
I would say it's definitely a bug, but I would like to ask: is there any workaround for this? Should I go back to v1?
Same here :(
To add to the choir: a bunch of wasted time and minutes due to this bug today.
Most helpful comment
Sorry for the drive by, but wanted to give this one a light +1.
Upgrading to cache@v2 caused my build to fail, but in a fairly non-obvious way. Based on the
Cache Size: ~0 MB (22 B)message (and thanks to this issue!), I was able to localize it a problem with the cache not being populated with anything, but even right now, it's not clear to me why that's the case — I double-, triple-, and quadruple-checked my paths, and there's nothing obviously wrong.Of course this is still suggestive of a problem on my end, but this would have been a lot faster to diagnose and debug if the cache action complained loudly if it determined an input path did not exist.