How to think about cache in CI vs Local Development?

Hi folks, I am in need of some guidance/resources to better understand how to think about the turbo cache across local development and CI/Preview deployments

I need to understand how to think about these two environments in terms of caching related to environment variables:

  • Development
  • Preview
    Production ā€“ Iā€™m not going to focus on production right now, as I just want to figure out my preview and development caching story first.

Basically, these two environments mean that the cache for CI will be completely different across these two environments (globalEnv settings in turbo.json).

Is that correct or expected? Should my CI jobs really be different for my CI and local development? Would love to have a better picture/understanding of this

Using globalEnv will invalidate all tasks whenever any environment variable changes. Instead, you can scope environment variable changes to certain tasks using env. Some docs are here: Using environment variables | Turborepo

1 Like