You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 959b4c8
Browse filesBrowse the repository at this point in the historyBrowse files
build(ci): retry a setup step that fails on a transient network error (#22212)
* build(ci): retry a setup step that fails on a transient network error
Every dependency install and browser download in CI ran once, so a registry
503 or a dropped connection failed the job and only a human re-run recovered
it. Both happened today: `yarn --frozen-lockfile` took `503 Service
Unavailable` on three tarballs across four jobs, and `install-firefox.js`
took `ECONNRESET`.
`tooling/retry.js` runs a command again when it exits non-zero, backing off
between attempts and propagating the last exit code, so a genuine failure
still fails. It uses node builtins only, because every caller runs before
`yarn install` has written `node_modules`, and it stays on the Node 10
baseline the legacy jobs run it under. Only network steps go through it;
`yarn link` is local and is left alone.
* build(ci): refuse an invalid retry setting and retry submodule fetches
`RETRY_ATTEMPTS=abc` reached the loop as `NaN`, where every `attempt >=
ATTEMPTS` is false, so a failing command retried until the job timed out —
the opposite of what the script is for. A non-integer, zero or negative
count, and a non-finite or negative delay, are now refused by name before
anything runs.
The `git submodule update` fetches go through the runner as well, which is
the same transient failure the rest of the wiring is about and what
AGENTS.md already claimed.
`retry.js` exports its pieces and runs only as the entry point, the way
`generate-css-data.js` does, so `test/unitCases/Retry.unittest.js` can drive
them: the two readers, a success, a retry that then succeeds, an exhausted
run keeping its exit code, a single allowed attempt, and a spawn error
rejecting rather than retrying.
* build(ci): keep the backoff inside the range a timer accepts
Node clamps a `setTimeout` above 2**31-1 ms to 1 ms, so a large
`RETRY_DELAY`, or enough doublings of a smaller one, turned the longest
backoff into an immediate retry — measured: a 2147483648 ms wait fired after
9 ms. `backoffFor` clamps the computed wait instead, and is covered for both
the doubling and the ceiling.
* build(ci): cover the entry point the retry runner is invoked through
The `require.main === module` block held the whole reading of `process.argv`
and `process.env`, which a unit test cannot reach and a spawned process does
not report, so those lines stood uncovered — 83.67% of the diff against a
90% target.
`main` reads the arguments and settings, `runAsScript` turns what it returns
or throws into an exit code, and the guard is the one line neither can be
asked about. Both are covered, including a refused setting reported rather
than thrown, so the file reads 98.3% of statements and every line and
function. What the command line does is unchanged for a success, a failure
it keeps the code of, an invalid setting and no arguments at all.
* build(ci): retry the install the invariants job added
The `invariants` job landed on main while this branch was open, and its
`yarn --frozen-lockfile` was the one network step not going through the
runner — which the guide now states as an invariant.
0 commit comments