CI: make Yarn Classic fallback cache a tmpfs (fresh per build)
Build and Deploy Verso / deploy (push) Successful in 11m9s
Build and Deploy Verso / deploy (push) Successful in 11m9s
#74 corrupted the persistent fallback cache again despite serialising the fetch, so the cause isn't a write race: BuildKit evicts part of that persistent cache mount between builds (the first build after each id bump always passed, later ones failed). Mount /usr/local/share/.cache/yarn as tmpfs so it's clean every build and nothing can be half-evicted; the Berry cache stays persistent. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+11
-7
@@ -25,14 +25,18 @@ ENV COREPACK_ENABLE_NETWORK=0
|
||||
|
||||
# Install yarn dependencies
|
||||
# -------------------------
|
||||
# YARN_NETWORK_CONCURRENCY=1 serialises Yarn's fetch step. The git-sourced
|
||||
# @replit/codemirror-* deps are prepared with Yarn Classic, which pulls *all*
|
||||
# esbuild platform binaries into the one shared /usr/local/share/.cache/yarn
|
||||
# folder; preparing several of them in parallel races and corrupts that cache
|
||||
# (EEXIST / missing .yarn-tarball.tgz). Serialising the fetch removes the race.
|
||||
# The git-sourced @replit/codemirror-* deps are prepared with Yarn Classic,
|
||||
# whose cache lives in /usr/local/share/.cache/yarn. We mount that as a *tmpfs*
|
||||
# (fresh every build) rather than a persistent BuildKit cache: when it was
|
||||
# persistent, BuildKit would garbage-collect/evict part of it between builds,
|
||||
# leaving a half-populated cache that Yarn Classic then tripped over (missing
|
||||
# .yarn-tarball.tgz / EEXIST). A clean cache per build is reliable; the cost is
|
||||
# re-fetching that small set of git deps. The valuable Berry cache
|
||||
# (server-ce-yarn-cache) stays persistent. YARN_NETWORK_CONCURRENCY=1 is kept
|
||||
# as cheap insurance against concurrent writes to the fresh cache.
|
||||
RUN --mount=type=cache,target=/root/.cache \
|
||||
--mount=type=cache,target=/root/.yarn/berry/cache,id=server-ce-yarn-cache \
|
||||
--mount=type=cache,target=/usr/local/share/.cache/yarn,id=server-ce-yarn-fallback-cache-v3 \
|
||||
--mount=type=tmpfs,target=/usr/local/share/.cache/yarn \
|
||||
--mount=type=tmpfs,target=/tmp node genScript install | YARN_NETWORK_CONCURRENCY=1 bash
|
||||
|
||||
# Add the actual source files
|
||||
@@ -40,7 +44,7 @@ RUN --mount=type=cache,target=/root/.cache \
|
||||
COPY --parents libraries/ services/ tools/migrations/ /overleaf/
|
||||
RUN --mount=type=cache,target=/root/.cache \
|
||||
--mount=type=cache,target=/root/.yarn/berry/cache,id=server-ce-yarn-cache \
|
||||
--mount=type=cache,target=/usr/local/share/.cache/yarn,id=server-ce-yarn-fallback-cache-v3 \
|
||||
--mount=type=tmpfs,target=/usr/local/share/.cache/yarn \
|
||||
--mount=type=cache,target=/overleaf/services/web/node_modules/.cache,id=server-ce-webpack-cache \
|
||||
--mount=type=tmpfs,target=/tmp \
|
||||
node genScript compile | YARN_NETWORK_CONCURRENCY=1 bash || \
|
||||
|
||||
Reference in New Issue
Block a user