cached file cannot be found in the next hit

Created on 30 May 2020  路  13Comments  路  Source: actions/cache

My workflow will cache llvm/lib and llvm/bin , and it succeeded at the first time:
https://github.com/hellodword/MyApplication/actions/runs/119157969

But the cached files cannot be found at the next time (but the cache key can be hitted):
https://github.com/hellodword/MyApplication/actions/runs/119660612

I tried a lot to find out the reason:

  • [x] I deleted the llvm/bin folder so the whole size of llvm is 290MB, it failed;
  • [x] With another workflow I cached a same folder structure, and use dd to create files so that the folder size can reach the same size (290MB), it succeeded;

Is it a bug or my usage problem? Any idea about this? Thanks.

Most helpful comment

just overlooked at step Releasing using Hub, there are branch switching action Switched to a new branch 'master' and your ollvm folder was likely be stashed and hence, the later step Post Cache multiple paths could not find any patterns matched. btw, the path ollvm is correct in your case.

All 13 comments

:wave: Looking at the Cache multiple paths step in the second link, I see it says Cache Size: ~0 MBs (22 B). It sounds like it's not finding the path to cache, creating an empty tar. Looking at your workflow file, I suspect this is because you're creating that directory under the GITHUB_WORKSPACE (mkdir ${GITHUB_WORKSPACE}/ollvm.out), which is different from the path you are caching (ollvm.out).

馃憢 Looking at the Cache multiple paths step in the second link, I see it says Cache Size: ~0 MBs (22 B). It sounds like it's not finding the path to cache, creating an empty tar. Looking at your workflow file, I suspect this is because you're creating that directory under the GITHUB_WORKSPACE (mkdir ${GITHUB_WORKSPACE}/ollvm.out), which is different from the path you are caching (ollvm.out).

I thought ${GITHUB_WORKSPACE} is the base dir of the path in action/cache@v2.

I tried in this: testcache/actions

@hellodword I met issues on cache when I try github actions too, the glob pattern in the path is likely the reason of missing cache files.

try to add debug flag ACTIONS_STEP_DEBUG in your repository secret to debug your steps, you should see the logs at step Post Cache multiple paths

[debug]Search path '/home/runner/work/testcache/testcache'

[debug]Matched: XXX

more information about debug
https://github.com/actions/toolkit/blob/master/docs/action-debugging.md#step-debug-logs

@hellodword I met issues on cache when I try github actions too, the glob pattern in the path is likely the reason of missing cache files.

try to add debug flag ACTIONS_STEP_DEBUG in your repository secret to debug your steps, you should see the logs at step Post Cache multiple paths

[debug]Search path '/home/runner/work/testcache/testcache'

[debug]Matched: XXX

more information about debug
https://github.com/actions/toolkit/blob/master/docs/action-debugging.md#step-debug-logs

Thanks!

Added ACTIONS_STEP_DEBUG here: MyApplication/actions

And change the ollvm.out to ollvm in order to exclude some pattern error with the dot.

But it still failed.

I cannot find the reason of deferent results between MyApplication/actions and testcache/actions.

@hellodword I met issues on cache when I try github actions too, the glob pattern in the path is likely the reason of missing cache files.
try to add debug flag ACTIONS_STEP_DEBUG in your repository secret to debug your steps, you should see the logs at step Post Cache multiple paths

[debug]Search path '/home/runner/work/testcache/testcache'

[debug]Matched: XXX

more information about debug
https://github.com/actions/toolkit/blob/master/docs/action-debugging.md#step-debug-logs

Thanks!

Added ACTIONS_STEP_DEBUG here: MyApplication/actions

And change the ollvm.out to ollvm in order to exclude some pattern error with the dot.

But it still failed.

I cannot find the reason of deferent results between MyApplication/actions and testcache/actions.

I noticed that your cache path could not be resolved at step Post Cache multiple paths.
Your path seems correct, but you could try using path: ./ollvm/*. path is a little bit tricky, for example, I would like to cache whole workspace with path ./, however, it doesnt work as expected. I should use ./* and it works fine. see glob patterns

[debug]Search path '/home/runner/work/MyApplication/MyApplication/ollvm'

[debug]Cache Paths:

[debug][]

I noticed that your cache path could not be resolved at step Post Cache multiple paths.
Your path seems correct, but you could try using path: ./ollvm/*. path is a little bit tricky, for example, I would like to cache whole workspace with path ./, however, it doesnt work as expected. I should use ./* and it works fine. see glob patterns

I tried both ./ollvm/* and ./ollvm/** and it also could not be resolved

U're so right, it's too tricky馃槶

I will try this

*/*/node_modules
**/yarn.lock

Hope **/ollvm will work...

@hellodword Any luck? Do you mind if I fork your repo to test this?

just overlooked at step Releasing using Hub, there are branch switching action Switched to a new branch 'master' and your ollvm folder was likely be stashed and hence, the later step Post Cache multiple paths could not find any patterns matched. btw, the path ollvm is correct in your case.

@hellodword Any luck? Do you mind if I fork your repo to test this?

No luck it still failed 馃槶

And no not mind at all.

just overlooked at step Releasing using Hub, there are branch switching action Switched to a new branch 'master' and your ollvm folder was likely be stashed and hence, the later step Post Cache multiple paths could not find any patterns matched. btw, the path ollvm is correct in your case.

Yes I think this is the reason!

Thanks for being a big help!

Thanks @etnet-raymondlin he is right! This is the reason.

Not the issue with actions/cache, sorry @dhadka

@hellodword @etnet-raymondlin Thanks! I appreciate both of you taking the time to diagnose this issue and report back.

Was this page helpful?
0 / 5 - 0 ratings