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

Remove home-rolled yarn caching #48237

Closed
wants to merge 1 commit into from

Conversation

NickGerleman
Copy link
Contributor

Summary: Changelog: [Internal]

Differential Revision: D67140004

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Dec 12, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D67140004

NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Dec 12, 2024
Summary:

Noticed this when trying to diagnose a stale caching issue, that might be related.

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. We really want to be caching the yarn cache, which has pristine packages before install
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).

This removes the custom logic, but only enables GHA Yarn caching on the main branch.


Changelog: [Internal]

Differential Revision: D67140004
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D67140004

NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Dec 12, 2024
Summary:

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. We really want to be caching the yarn cache, which has pristine packages before install
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 a recent job, with a cache key that hasn't changed in a while, failed to restore cache.

So for now, I'm going back to previous method of using GHA built-in caching for this, even if it has the potential to generate more artifacts than before. Since I'm not sure this cache taking up 10-20% is unreasonable, stale cache issues are pretty insidious, and cache underuse is also expensive.


Changelog: [Internal]

Differential Revision: D67140004
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D67140004

Summary:

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. We really want to be caching the yarn cache, which has pristine packages before install
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 isn't correctly working, this goes back to previous solution, which may store more artifacts (but working cache should also reduce cost by making jobs run faster).

Changelog: [Internal]

Differential Revision: D67140004
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D67140004

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Dec 12, 2024
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in a28867f.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @NickGerleman in a28867f

When will my fix make it into a release? | How to file a pick request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants