Closed foosinn closed 3 years ago
IMHO a workdir doesn't make sense. Instead of that we should fix the plugin to accept absolute paths, and not only paths within the working directory.
You can supply any absolute path you want. I use it for /cache
.
I called it workdir since it simply changes the working directory of the cache plugin before running the plugin.
Absolute paths are not working currently. they are getting cached, but they are getting restored into the wrong path so far.
Sorry i didn't understand your first reply correctly.
I guess changing the behavior is a lot cleaner, but will break existing cache directories, since tar files contain only relative paths.
An boolean option like PLUGIN_ABSOLUTE
is an option, but leads to the same behavior as PLUGIN_WORKDIR=/
.
Any ideas how to solve this without breaking existing changes?
We got to introduce a breaking change anyway, but I'm not sure if we should introduce it because of some working directory...
we shouldn't need to change the working directory of the process. Instead we should support absolute paths. Do we not support absolute paths at the moment? I feel like we should be able to support absolute paths without any breaking changes or new yaml fields, but admittedly it has been a while since I looked into cache plugins.
AFAIK tar files have a directory structure but no information if the path is absolute or not. That's why packaging with relative and absolute paths both works but unpacking amuses paths relative to the working directory.
@techknowlogick we're not sure about this change at this time. Feels like it should be in the cache lib TBH.
sorry, just did changes for our fork!
@foosinn I'm not against the patch it just seems like it should live at https://github.com/drone/drone-cache-lib
Adds an option to change the working directory.
This allows to extract the cache outside of the source directory.
closes #52