action-docker-layer-caching
action-docker-layer-caching copied to clipboard
ENOENT: no such file or directory, stat 'image-layers/xxxxxxx/layer.tar'
Hello,
First, thank you for the great action that you have created. We have been facing a strange error lately on version 0.0.4 and the same error after upgrading to 0.0.8. This action is running on linux (ubuntu-latest).
Here is the issue that we are facing and I was wondering if this would ring a bell to you?

The issue can be seen with this build: https://github.com/criteo/JVips/runs/1441932624
Can you please help me find out what I can check further to solve that error? In the meantime I set the continue-on-error flag in https://github.com/clems4ever/JVips/commit/59a3bd7737df4dd2b261af2124009a370be3ee1c but I'd like to have your point of view on this error anyway.
Thank you in advance.
This action uses the workflow name Build and release as a key for the cache; the error seems to be due to the fact that both Windows and Linux builds share a key.
If you manually set a key for each job, this cache should work well. https://github.com/satackey/action-docker-layer-caching#inputs
Yes, it does look like the shared cache is causing the problem in the case above. That said, it's possible to get the same error on a single-job workflow if it ever runs concurrently: https://github.com/rcowsill/layer-cache-test/actions?query=branch%3Amain
In that test I committed "Test 3, Step 2" before the run for "Test 3, Step 1" had written its cache. The second job can't save all its layer cache files because one already exists. That results in a corrupted cache, making the "Test 3, Step 3" run fail.
This can happen because the extracted tar output from docker save uses symlinks for layers with identical contents. For a set of layers with the same content, one will have a full copy of layer.tar and the others have a symlink to that. This error happens if the cache contains a symlink without the corresponding layer.tar when this line is reached:
https://github.com/satackey/action-docker-layer-caching/blob/653164abc7256353507963bcc28480892acc2ca3/src/LayerCache.ts#L93
I'm going to try changing the action to save only the real layer.tar files and keep all the symlinks in the root cache. As well as fixing this issue it should make the caching more efficient. If it works it'll be possible to share caches across jobs too, though that might need some further changes.
EDIT: The proof of concept works on Linux: https://github.com/rcowsill/layer-cache-test/actions?query=branch%3Atest%2F75-fix On Windows jobs it fails due to #87.
See discussion #97 for more detail on a proposed fix for this.
I am still getting this issue on version 11:
Error: Error: ENOENT: no such file or directory, stat '/home/runner/work/_actions/satackey/action-docker-layer-caching/v0.0.11/dist/ttsc-dist/.adlc/image-layers/18bf75313098a3270fa0787659dc50475861705f6596a8fdfacf2dea982adc26/layer.tar'
Rerunning the workflow results in the same error.