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

More options for invalidating caches using the manifest #89

Open
kevinburkesegment opened this issue Jan 6, 2025 · 1 comment · May be fixed by #93
Open

More options for invalidating caches using the manifest #89

kevinburkesegment opened this issue Jan 6, 2025 · 1 comment · May be fixed by #93

Comments

@kevinburkesegment
Copy link

For Go, two come to mind:

  • Caching the module directory: basically you want to invalidate this when go.mod or go.sum changes. However, as currently constructed the manifest/hash_files function make this impossible

  • Caching intermediate build/test artifacts: I want to invalidate this when any file ending in .go changes anywhere in the repo. Also difficult to do as currently constructed - I don't want to grab everything in a folder (and e.g. cache the contents of a .git directory, random .md files). But would be possible with e.g. a **/*.go wildcard.

I can't really use the plugin as currently designed without support for these two use cases.

@kevinburkesegment kevinburkesegment changed the title More complicated cache use cases More options for invalidating caches using the manifest Jan 6, 2025
@toote toote linked a pull request Feb 1, 2025 that will close this issue
@toote
Copy link
Contributor

toote commented Feb 1, 2025

@kevinburkesegment thanks a lot for the use-case. They are quite eye-opening and I have implemented the option to specify multiple manifests in #63 which should take care of the first item.

Implementing the second one is a lot more cumbersome due to the way the recursive hashing of the files and folders is done. The multi-folder traversal in path globs (i.e. **) in bash is not implemented everywhere and even if it is, it depends on the globstar option that is turned off by default . But I may have a workaround: create a repository-level post-checkout hook with something like find . -name '*.go' -exec shasum \{\} \; > gofiles, which means that you can now use this gofiles file as your manifest file option. When the checksum of any of them changes the cache should get invalidated. What do you think?

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

Successfully merging a pull request may close this issue.

2 participants