Skip to content
  • Nick Gerleman's avatar
    Remove home-rolled yarn caching (#48237) · a28867f9
    Nick Gerleman authored
    Summary:
    Pull Request resolved: https://github.com/facebook/react-native/pull/48237
    
    Noticed this when trying to diagnose what seemed like a stale caching issue. It effectively reverts D59917944.
    
    D59917944 added logic to only do yarn caching on main, but it has some correctness issues:
    1. We cache `node_modules` instead of the yarn cache, which may contain e.g. build artifacts, or other scratch/cache files written (such as anything that writes to `node_modules/.cache`). We really want to be caching the yarn cache, which has pristine packages before install, which I think it will also need to perform the real install anyways.
    2. We key the cache on root `package.json`, which is missing a lot of information (both provided by the other `package.json` in the repo, but mostly, the lockfile resolution).
    
    We only save cache when we're on `refs/heads/main` (so continuous builds against main), and supposedly, builds against base branch should be able to restore against those, but recent PR jobs I have seen, where `package.json` has not changed, all have `Cache not found for input keys: node-modules-068350889e87919c1c6c2c220c8d2d92db13f38820bf2efb315d1274b97bc367`
    
    Because of the potential correctness issues, and that the strategy for limiting to main seemingly is not allowing cache to be used in PR, this diff goes back to previous solution, which may store more artifacts (but working cache should also reduce cost by making jobs run faster).
    
    Changelog: [Internal]
    
    Reviewed By: cipolleschi
    
    Differential Revision: D67140004
    
    fbshipit-source-id: f74074a498af56b1837fa23cf80795f76935b762
    a28867f9