How does the `gha-cache-key` work <here>? What's t...
# general
r
How does the
gha-cache-key
work here? What's the use case for busting the cache? Would we want to bust the cache every time we increment versions or can GHA caches be updated?
p
pants uses granular caching which is not a great story for CI based caching... see https://dev.to/benjyw/better-cicd-caching-with-new-gen-build-systems-3aem
r
Heard on that but am trying to make do with the tools available to me at the moment. I think what I want to do is set it up so we can cache the current
main
branch build + the builds of any open PRs and then delete those caches when the PRs are closed / when main is updated.
b
GHA caches aren't updated: if there's an exact hit for a key, it's not re-uploaded with new content. That parameter is mixed in with some other data to make the actual cache keys: https://github.com/pantsbuild/actions/blob/402e2fbd0b1acafb3b0df682a9f87b48fa4b8c4d/init-pants/action.yaml#L112 Generally, one doesn't need to bust caches, and Github's least-recently-used cache eviction will handle getting rid of old ones (e.g. after incrementing versions). Although, these monolithic CI caches can get huge, so you may want to either bust the cache occasionally or have a rule like "nuking the cache when too big" in https://www.pantsbuild.org/docs/using-pants-in-ci