Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow excluding files from caching #203

Open
KucharczykL opened this issue Apr 17, 2022 · 6 comments
Open

Allow excluding files from caching #203

KucharczykL opened this issue Apr 17, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@KucharczykL
Copy link

Is your feature request related to a problem? Please describe.
I have a folder that I want to cache but not all of its subfolders and files.

Describe the solution you'd like
I would like to specify which folders or files not to cache.

Describe alternatives you've considered
I can probably manually delete the files in a separate step just before rebuilding the cache.

Additional context
GitHub Actions support this using the ! character to indicate excluded files or folders. See https://github.com/actions/cache#v2

@bdebyl
Copy link
Contributor

bdebyl commented Jul 19, 2022

This may not be too difficult to implement, though I'm not sure how much of an issue this is for others. Is there any specific reason certain files or folders may want to be omitted? Clarifying the justification for why this is a good feature to add to drone-cache would be greatly appreciated!

@bdebyl bdebyl added the enhancement New feature or request label Jul 19, 2022
@KucharczykL
Copy link
Author

KucharczykL commented Jul 19, 2022

Generally, the same reason why both blacklists and whitelists exist: sometimes you want everything except for one file, and sometimes you want nothing except for one file. Solving both with only one solution is tedious or even impossible.

More concretely, I have a folder I want to cache but there's another folder inside it that I don't want to cache. The reason for that is that each is built with a different command so caching both at the same time would mean I have to build both if one of them needs rebuilding (kinda invalidating the caching step).

Even more concretely, I rewrote the GitHub Actions template for publishing Dendron, you can see the original here: https://wiki.dendron.so/notes/FnK2ws6w1uaS1YzBUY3BR/#steps---setup-github-actions

There you can see two caching steps: "Restore Node modules cache" and "Restore Next cache".

@bdebyl
Copy link
Contributor

bdebyl commented Jul 19, 2022

Hmm I see. We've just recently added double-star glob support for mount paths in the settings (e.g. path/**/subpath, path/**, etc.) as part of #209.

I'll try my hand at implementing this later this afternoon as it shouldn't be too difficult. I may have to add single-star glob matching as well, which should be much more straightforward once #209 is merged. For clarity, this would allow flexible usage of the exclusionary rules. Let me know if this is something you do or do not want.

It may be a bit difficult to add exclusions of specific files due to the simplistic way the mount function works as part of the plugin, but for simple directory exclusions this should be an easy change to make.

Will get back to you and let you know if this will be too challenging to be targeted for the v1.4.0 release of drone-cache :)

@KucharczykL
Copy link
Author

Nice, thank you for considering it!

@bdebyl
Copy link
Contributor

bdebyl commented Jul 19, 2022

No problem @KucharczykL

Seems like this will take a bit more effort than I had time for today. I'll keep you posted but will try to get this done by this week depending on what comes up.

@KucharczykL
Copy link
Author

Hi @bdebyl, any luck with this? 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants