ci: drop npm/node_modules cache — runner cache server is unreachable
The act_runner's internal cache server (172.17.0.2:46367) can't be reached
from job containers: `setup-node` with `cache: npm` spends ~4m42s on
`getCacheEntry failed: connect ETIMEDOUT` every build, then reports "npm cache
is not found" — ~5 min of pure cost for zero caching. The `actions/cache`
node_modules steps added in 79258668 would hit the same dead server and hang
too, so they're removed here as well.
Removing the cache usage reclaims ~5 min/build with no loss (nothing was being
cached). The fast-gates-before-build reorder is kept. Re-enable caching once
the runner's cache server is reachable from job containers.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+6
-22
@@ -30,23 +30,14 @@ jobs:
|
|||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.node-version'
|
node-version-file: '.node-version'
|
||||||
cache: npm
|
|
||||||
|
|
||||||
# Cache the installed tree keyed on the lockfile + Node version. On a hit
|
|
||||||
# (lockfile unchanged) `npm ci` — extraction + the postinstall folds patch —
|
|
||||||
# is skipped entirely and node_modules is just restored (the patch is baked
|
|
||||||
# into the cached tree). setup-node's `cache: npm` still warms the download
|
|
||||||
# cache for the miss path. Save runs only on a miss AND only if install
|
|
||||||
# succeeded (`success()`), so a failed `npm ci` can never poison the cache.
|
|
||||||
- name: Restore node_modules
|
|
||||||
id: node-modules
|
|
||||||
uses: actions/cache/restore@v4
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json', '.node-version') }}
|
|
||||||
|
|
||||||
|
# No npm / node_modules cache: the act_runner's internal cache server is
|
||||||
|
# unreachable from job containers (`getCacheEntry failed: connect ETIMEDOUT
|
||||||
|
# 172.17.0.2`), so every cache restore hangs ~5 min and then fails — pure
|
||||||
|
# cost, zero benefit. `cache: npm` was removed from Setup Node above for the
|
||||||
|
# same reason. Re-enable both (setup-node `cache: npm` + an actions/cache
|
||||||
|
# node_modules step) once the runner's cache server is reachable from jobs.
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
if: steps.node-modules.outputs.cache-hit != 'true'
|
|
||||||
# Harden against transient registry network failures (ECONNRESET etc.):
|
# Harden against transient registry network failures (ECONNRESET etc.):
|
||||||
# raise npm's built-in fetch retries/timeouts and retry `npm ci` up to
|
# raise npm's built-in fetch retries/timeouts and retry `npm ci` up to
|
||||||
# 3 times with backoff before failing the build.
|
# 3 times with backoff before failing the build.
|
||||||
@@ -66,13 +57,6 @@ jobs:
|
|||||||
sleep $((attempt * 15))
|
sleep $((attempt * 15))
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: Save node_modules
|
|
||||||
if: steps.node-modules.outputs.cache-hit != 'true' && success()
|
|
||||||
uses: actions/cache/save@v4
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json', '.node-version') }}
|
|
||||||
|
|
||||||
# ── Quality gates run BEFORE the slow build so a format/lint/type/test
|
# ── Quality gates run BEFORE the slow build so a format/lint/type/test
|
||||||
# error fails in seconds instead of after the ~minutes-long build. All are
|
# error fails in seconds instead of after the ~minutes-long build. All are
|
||||||
# hard gates — any failure fails the job and blocks the deploy. The tree is
|
# hard gates — any failure fails the job and blocks the deploy. The tree is
|
||||||
|
|||||||
Reference in New Issue
Block a user