cache
cache copied to clipboard
Cache miss when restoring within a reusable workflow
Greetings!
Our organization uses a reusable workflow to build our docker images. We recently attempted to add caching to this workflow to speed up the build process. While we already use the cache action for our separate CI workflow, we've noticed the build workflow always fails to hit the cache and it's unclear why.
Here's the current reusable build workflow
We verified multiple times that Cache exists in the default branch (main
)
Based on the documentation we should be able to restore this cache in our feature branches, but we're getting cache misses on the restore steps
Is there documentation related to this particular scenario or are we missing a key step to make this work? Any help would be appreciated.
Did you find a solution? It is happening on our project as well.
If they keys are identical, it's likely the version. Make sure that the paths are identical. I see that you're using a relative path.
Remember that if you have a workflow in myorg/repo1 that caches the folder folder
the path is actually /home/runner/work/repo1/repo1/folder
.
When you try to restore the path folder
in repo2, it resolves to /home/runner/work/repo2/repo2/folder
, which isn't a match.
If they keys are identical, it's likely the version. Make sure that the paths are identical. I see that you're using a relative path.
Remember that if you have a workflow in myorg/repo1 that caches the folder
folder
the path is actually/home/runner/work/repo1/repo1/folder
.When you try to restore the path
folder
in repo2, it resolves to/home/runner/work/repo2/repo2/folder
, which isn't a match.
Thanks! This resolved my issue.
One CI used ./my_folder
relative path. Another CI used my_folder
relative path. They pointed to exactly same absolute path but strings were different and I was getting cache miss.