drone-plugins / drone-s3-cache

Caches build artifacts to S3 compatible storage backends
http://plugins.drone.io/drone-plugins/drone-s3-cache
Apache License 2.0
28 stars 30 forks source link

workdir #53

Closed foosinn closed 3 years ago

foosinn commented 5 years ago

Adds an option to change the working directory.

This allows to extract the cache outside of the source directory.

closes #52

tboerger commented 5 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.

foosinn commented 5 years ago

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.

tboerger commented 5 years ago

Absolute paths are not working currently. they are getting cached, but they are getting restored into the wrong path so far.

foosinn commented 5 years ago

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?

tboerger commented 5 years ago

We got to introduce a breaking change anyway, but I'm not sure if we should introduce it because of some working directory...

bradrydzewski commented 4 years ago

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.

foosinn commented 4 years ago

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.

donny-dont commented 3 years ago

@techknowlogick we're not sure about this change at this time. Feels like it should be in the cache lib TBH.

foosinn commented 3 years ago

sorry, just did changes for our fork!

donny-dont commented 3 years ago

@foosinn I'm not against the patch it just seems like it should live at https://github.com/drone/drone-cache-lib