Unverified Commit 73dacb60 authored by Benjamin Woodruff ‮'s avatar Benjamin Woodruff Committed by GitHub

Normalize pnpm store cache keys (#99957)

We didn't include OS and architecture in our pnpm cache keys, which
could often cause us to have to redownload cached packages during
install (e.g. cache populated on x86-64, but read on arm64).

I asked codex about the naming disparity between these jobs:

> this was historical drift, not two different store types.
>
> - [\#93508
(https://github.com/vercel/next.js/pull/93508)](<https://github.com/vercel/next.js/pull/93508>)
introduced `pnpm-store-root-v1-*` on May 5. Jobs that skipped `pnpm
install` had saved incomplete stores—about **14 MB instead of 440 MB**.
The PR aligned the cache/install conditions and changed the key to
invalidate those caches. “root” means a complete repository-root
install.
> - [\#93411
(https://github.com/vercel/next.js/pull/93411)](<https://github.com/vercel/next.js/pull/93411>)
merged four days later, adding caching to `fetch-test-timings` with the
old `pnpm-store-v2-*` key. Its comment intended to match the reusable
workflow, but the key was already outdated.
>
> Both cache `pnpm store path` after a root install. Unifying them is
appropriate; our branch now consistently uses `pnpm-store-root-v2-*`.
parent 1e1f9e69
...@@ -171,7 +171,7 @@ jobs: ...@@ -171,7 +171,7 @@ jobs:
id: cache-pnpm-store id: cache-pnpm-store
with: with:
path: ${{ steps.get-store-path.outputs.STORE_PATH }} path: ${{ steps.get-store-path.outputs.STORE_PATH }}
key: pnpm-store-root-v1-${{ hashFiles('pnpm-lock.yaml') }} key: pnpm-store-root-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }}
# Do not use restore-keys since it leads to indefinite growth of the cache. # Do not use restore-keys since it leads to indefinite growth of the cache.
- run: pnpm install - run: pnpm install
......
...@@ -208,7 +208,7 @@ jobs: ...@@ -208,7 +208,7 @@ jobs:
id: cache-pnpm-store id: cache-pnpm-store
with: with:
path: ${{ steps.get-store-path.outputs.STORE_PATH }} path: ${{ steps.get-store-path.outputs.STORE_PATH }}
key: pnpm-store-v2-${{ hashFiles('pnpm-lock.yaml') }} key: pnpm-store-root-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }}
# Do not use restore-keys since it leads to indefinite growth of the cache. # Do not use restore-keys since it leads to indefinite growth of the cache.
- name: Install dependencies - name: Install dependencies
......
...@@ -371,7 +371,7 @@ jobs: ...@@ -371,7 +371,7 @@ jobs:
id: cache-pnpm-store id: cache-pnpm-store
with: with:
path: ${{ steps.get-store-path.outputs.STORE_PATH }} path: ${{ steps.get-store-path.outputs.STORE_PATH }}
key: pnpm-store-root-v1-${{ hashFiles('pnpm-lock.yaml') }} key: pnpm-store-root-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }}
# Do not use restore-keys since it leads to indefinite growth of the cache. # Do not use restore-keys since it leads to indefinite growth of the cache.
- run: pnpm install - run: pnpm install
......
...@@ -130,7 +130,7 @@ jobs: ...@@ -130,7 +130,7 @@ jobs:
id: cache-pnpm-store id: cache-pnpm-store
with: with:
path: ${{ steps.get-store-path.outputs.STORE_PATH }} path: ${{ steps.get-store-path.outputs.STORE_PATH }}
key: pnpm-store-root-v1-${{ hashFiles('pnpm-lock.yaml') }} key: pnpm-store-root-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }}
# Do not use restore-keys since it leads to indefinite growth of the cache. # Do not use restore-keys since it leads to indefinite growth of the cache.
- if: steps.new-commits.outputs.has_new_commits == 'true' - if: steps.new-commits.outputs.has_new_commits == 'true'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment