drone-cache
drone-cache copied to clipboard
Cache restore not working for glob paths
Describe the bug
When using glob paths on the mount
value for directories, those directories aren't restored on subsequent pipeline runs
To Reproduce Steps to reproduce the behavior:
- Using the following config
image: meltwater/drone-cache
settings:
backend: gcs
cache_key: [REDACTED]/{{ checksum "yarn.lock" }}
json_key: [REDACTED]
bucket: [REDACTED]
region: [REDACTED]
mount:
- 'packages/app/node_modules'
- 'packages/backend/node_modules'
- 'node_modules'
- 'plugins/**/node_modules'
- Use
restore: true
for the restore step andrebuild: true
for the rebuild step
Expected behavior
All paths in plugins/**/node_modules
will be restored on a subsequent pipeline run after the cache has been created/rebuilt
Update cache The logs for the step that updates the cache indicate that the folders in the glob paths were successfully updated:
level=info name=drone-cache ts=2023-03-15T16:54:51.236145545Z caller=rebuilder.go:73 component=plugin component=rebuilder msg="rebuilding cache for directory" local=plugins/sqsp-annotations/node_modules remote=backstage/backstage/npm-modules/6278771a12b52f4d36aa67eff9bd2067/plugins/sqsp-annotations/node_modules
level=info name=drone-cache ts=2023-03-15T16:54:51.236157985Z caller=rebuilder.go:73 component=plugin component=rebuilder msg="rebuilding cache for directory" local=plugins/sqsp-drone/node_modules remote=backstage/backstage/npm-modules/6278771a12b52f4d36aa67eff9bd2067/plugins/sqsp-drone/node_modules
level=info name=drone-cache ts=2023-03-15T16:54:51.236176605Z caller=rebuilder.go:73 component=plugin component=rebuilder msg="rebuilding cache for directory" local=plugins/sqsp-github/node_modules remote=backstage/backstage/npm-modules/6278771a12b52f4d36aa67eff9bd2067/plugins/sqsp-github/node_modules
Restore cache
The logs for the step that restores the cache on a subsequent pipeline run do not contain any references to paths in plugins/**/node_modules
. They only contain references to non glob paths included in the mount
list.
Description I have written a script that runs in a step following on from the restore cache step. It produces the following output:
'./plugins/sqsp-annotations/node_modules' not found, cannot restore from cache
'./plugins/sqsp-drone/node_modules' not found, cannot restore from cache
'./plugins/sqsp-github/node_modules' not found, cannot restore from cache
I have checked that indeed all paths in plugins/**/node_modules
were not restored. This isn't an issue if I manually specify all paths in plugins/**/node_modules
Desktop (please complete the following information):
NA using drone with meltwater/drone-cache