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

Caching with save stack work doesn't include ~/.stack #30

Closed
pbrisbin opened this issue Feb 27, 2020 · 2 comments
Closed

Caching with save stack work doesn't include ~/.stack #30

pbrisbin opened this issue Feb 27, 2020 · 2 comments

Comments

@pbrisbin
Copy link

#!/bin/bash -eo pipefail
~/.local/bin/cache-s3 --bucket frontrow-ops --prefix ci-cache/build-backend save stack work
Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
[cache-s3][Info ][Thu, 27 Feb 2020 15:36:31 UTC]: Caching: /root/megarepo/backend/.stack-work
[cache-s3][Info ][Thu, 27 Feb 2020 15:36:31 UTC]: Caching: /root/megarepo/backend/core/.stack-work
[cache-s3][Info ][Thu, 27 Feb 2020 15:36:31 UTC]: Caching: /root/megarepo/backend/data-gen/.stack-work
[cache-s3][Info ][Thu, 27 Feb 2020 15:36:31 UTC]: Caching: /root/megarepo/backend/entities/.stack-work
[cache-s3][Info ][Thu, 27 Feb 2020 15:36:31 UTC]: Caching: /root/megarepo/backend/fancy-api/.stack-work
[cache-s3][Info ][Thu, 27 Feb 2020 15:36:31 UTC]: Caching: /root/megarepo/backend/frontrow-app/.stack-work
[cache-s3][Info ][Thu, 27 Feb 2020 15:36:31 UTC]: Caching: /root/megarepo/backend/jobs/.stack-work
[cache-s3][Info ][Thu, 27 Feb 2020 15:36:31 UTC]: Caching: /root/megarepo/backend/provisioning/.stack-work
[cache-s3][Info ][Thu, 27 Feb 2020 15:36:31 UTC]: Caching: /root/megarepo/backend/roster-management/.stack-work
[cache-s3][Info ][Thu, 27 Feb 2020 15:36:31 UTC]: Caching: /root/megarepo/backend/text-assets/.stack-work

Notice ~/.stack is not included. This makes the caching incomplete and a subsequent rebuild (with no changes) goes on to compile everything again. I think ~/.stack should always be included in a stack-aware caching.

@lehins
Copy link
Contributor

lehins commented Feb 27, 2020

There is a separate command for saving global stack environment, run:

$ ~/.local/bin/cache-s3 --bucket frontrow-ops --prefix ci-cache/build-backend save stack

And it will do the right thing.

Reason for separating into two distinct commands is because for feature branches you might not need to save global ~/.stack path and just reuse the one from master branch, since the set of dependencies doesn't change that often on projects.

It is all documented in the readme: https://github.com/fpco/cache-s3#stack

Feel free to reopen if I misunderstood you problem for some reason.

@lehins lehins closed this as completed Feb 27, 2020
@pbrisbin
Copy link
Author

Thanks for quick response, sorry I missed that! I was confused because we can't get that benefit right now. With some version of Stack multi-package, custom-snapshot projects store things in ~/.stack that are needed even if dependencies have not changed. I don't know all the details, but I think commercialhaskell/stack#4893 (comment) is related.

Anyway, I guess saving and restoring both stack and stack work would be equivalent to the caching we're doing now.

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

No branches or pull requests

2 participants