-
Notifications
You must be signed in to change notification settings - Fork 842
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
Cache being busted after restoring directory #5125
Comments
Could be https://stackoverflow.com/a/61178945/84401 ? |
The current workaround for this is to run this before doing stack work in your ci steps: find ./your ./src ./directories -name "*.hs" -print0 | xargs -0 -I '{}' \
touch \
--no-create \
--reference '{}' \
--date "1000 days ago" \
'{}' This causes the modified time to constantly be different (so all files are checked against the digest and mark dirty if needed) and very long time ago so that the Also worth noting that calculating the digest on the build step is very fast! So removing mod time check and always checking digest could be an option as well. Maybe make it default and enable mod time check an optimization step if you know you will keep a clean file system (like locally for example). |
OT: I'd love to see stack to change to a content addressed caching system. Filesystem metadata typically is a weak signal. In all custom build systems I write I only use it as tie breaker (if at all). |
The hack unfortunately doesn't work when adding new files. Since they are before the build time they will not be marked as dirty. I'm working on a PR now to see how people feel about removing mod time altogether. |
Remove ModTime check during build (#5125)
Fixed with #5351 |
Thanks! |
Stack version
Used latest 2.1.3 and latest HEAD
Method of installation
Download linux stack then run
upgrade --git
Problem/Question
We are using semaphore CI to compile our project and have not been able to get our project compilation cached. We run stack inside a docker container (for all intents and purposes, it's a regular stack build --test just inside docker).
We cache the stack-root directory and restore it without issues, meaning ghc does not re-download/compile and packages are not re-compiled.
We also cache .stack-work directory and restore it but our build command always rebuilds as if there was no cache. The relevant bits of information from the log below seem to act as if there is a cache, but it ignores it completely.
It unregisters a single file change (to test) but all 818 modules are recompiled:
The shas seen here are identical to the shas used in the previously cached build.
My assumption is that the cache restore is messing with some file inside stack-work that's causing the cache to bust. My question is which file(s) is that and is there anyway to force stack to not do that?
The text was updated successfully, but these errors were encountered: