ci: stop fetching an unpinned Yarn before the pinned one - #10306
Open
dpage wants to merge 1 commit into
Open
Conversation
Everywhere we build the JS, we asked Yarn to install itself twice:
yarn set version berry
yarn set version <the version from packageManager>
The first call fetches whichever release is "berry" today and the second
immediately replaces it, so every build made two downloads to end up with one
Yarn, and the one that could not be reproduced tomorrow was fetched first.
That first fetch broke CI outright on 17 August 2026, during a GitHub
incident, when it returned an empty body and Yarn 1 died writing it out:
error TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of
type string or an instance of Buffer, TypedArray, or DataView
at writeFile (node:fs:2373:5)
The unpinned call is dropped everywhere it appeared: Make.bat, the macOS and
pip package builds, and the four workflows. The packaging scripts keep their
pinned "yarn set version ${YARN_VERSION}", which still reads packageManager
from package.json, so their behaviour is unchanged beyond losing a download.
The workflows go further and use Corepack, which reads packageManager itself
and provisions exactly that Yarn without writing .yarnrc.yml and
.yarn/releases into the repository root, where the JS project is not. The
Dockerfile already installed and enabled Corepack immediately before both
"set version" calls, so both were redundant there and are simply removed.
CONTRIBUTING.md and README.md already tell contributors to start with
"corepack enable", so this brings the automation in line with the documented
setup. Note that Corepack ships with Node.js only up to (but not including)
25.0.0, so it will need installing explicitly once the runners move past it,
as the Dockerfile already does.
|
Caution Review failedAn error occurred during the review process. Please try again later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Everywhere we build the JS, we asked Yarn to install itself twice:
The first call fetches whichever release is "berry" today and the second immediately replaces it, so every build made two downloads to arrive at one Yarn, and the one that could not be reproduced tomorrow was fetched first.
That first fetch broke CI outright today, during the GitHub incident, when it returned an empty body and Yarn 1 died writing it out:
It took out
check-javascript-styleandrun-javascript-testson #10299, and killed three separate runs of an unrelated investigation before any test executed.What changes
The unpinned call goes everywhere it appeared:
Make.bat, the macOS and pip package builds, and the four workflows. The packaging scripts keep their pinnedyarn set version "${YARN_VERSION}", which still readspackageManagerfrompackage.json, so their behaviour is unchanged beyond losing a download.pkg/linux/build-functions.shneeded nothing, having only ever used the pinned form.The four workflows go further and use Corepack, which reads
packageManageritself and provisions exactly that Yarn without writing.yarnrc.ymland.yarn/releasesinto the repository root, where the JS project is not.The
Dockerfilealready rannpm install -g corepack && corepack enableimmediately before bothset versioncalls, so both were redundant there and are simply removed.Testing
docker build --target app-buildersucceeds with the change, building the image throughyarn installandyarn run bundleto a cleanwebpack compiledand a tagged image. Sinceweb/yarn.lockis__metadata: version: 10, which Yarn 1 cannot parse, the install succeeding is itself proof that Corepack provisioned Yarn 4 frompackageManagerwith noset versioninvolved.All four workflows parse as YAML with exactly one
corepack enablestep each, and the three modified shell scripts passbash -n.Worth knowing
Corepack ships with Node.js only up to (but not including) 25.0.0, so once the runners move past that it will need installing explicitly, as the
Dockerfilealready does.Only
run-javascript-tests.ymlpins a Node version (20.x); the other three take the runner default, socorepack enabledepends on that default staying below 25. Pinning them explicitly would make it deterministic, but it also changes which Node builds the bundle, so I have left that out of a CI plumbing fix rather than slipping it in.Dockerfileline 31 still installs Alpine'syarnpackage alongsidenpm, which looks redundant now that Corepack provides the shim. I have not touched it here, as it deserves its own verification.