CI: retry Yarn Classic dep packing on transient esbuild fetch corruption
Build and Deploy Verso / deploy (push) Successful in 11m5s
Build and Deploy Verso / deploy (push) Successful in 11m5s
Build #78 failed in the compile step while Yarn Classic prepared the @replit/codemirror-* git deps: fetching esbuild's per-platform binaries returned truncated tarballs ("the file appears to be corrupt" / missing .yarn-tarball.tgz). The tmpfs classic cache is fresh each build, so there is no stale entry to blame and nothing to fall back to — it is a transient download failure (builds #75-77 passed with an identical Dockerfile). Wrap both the install and compile steps in a 3-attempt retry loop that wipes the Yarn Classic cache (/usr/local/share/.cache/yarn) and re-fetches before giving up, dumping pack.log on final failure. The persistent Berry cache and YARN_NETWORK_CONCURRENCY=1 are unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+22
-3
@@ -34,10 +34,22 @@ ENV COREPACK_ENABLE_NETWORK=0
|
||||
# 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.
|
||||
#
|
||||
# Preparing those git deps also makes Yarn Classic fetch esbuild's ~10
|
||||
# per-platform binaries, whose downloads occasionally arrive truncated ("the
|
||||
# file appears to be corrupt" / missing .yarn-tarball.tgz). Since the tmpfs is
|
||||
# fresh each build there is nothing to fall back to, so we wrap the step in a
|
||||
# small retry loop that wipes the classic cache and re-fetches before failing.
|
||||
RUN --mount=type=cache,target=/root/.cache \
|
||||
--mount=type=cache,target=/root/.yarn/berry/cache,id=server-ce-yarn-cache \
|
||||
--mount=type=tmpfs,target=/usr/local/share/.cache/yarn \
|
||||
--mount=type=tmpfs,target=/tmp node genScript install | YARN_NETWORK_CONCURRENCY=1 bash
|
||||
--mount=type=tmpfs,target=/tmp \
|
||||
for i in 1 2 3; do \
|
||||
node genScript install | YARN_NETWORK_CONCURRENCY=1 bash && exit 0; \
|
||||
echo "==== install attempt $i failed; wiping Yarn Classic cache and retrying ===="; \
|
||||
rm -rf /usr/local/share/.cache/yarn/* 2>/dev/null || true; \
|
||||
done; \
|
||||
exit 1
|
||||
|
||||
# Add the actual source files
|
||||
# ---------------------------
|
||||
@@ -47,8 +59,15 @@ RUN --mount=type=cache,target=/root/.cache \
|
||||
--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 || \
|
||||
(echo "==== PACK LOGS ====" && find /tmp -name pack.log -exec cat {} \; && exit 1)
|
||||
for i in 1 2 3; do \
|
||||
node genScript compile | YARN_NETWORK_CONCURRENCY=1 bash && exit 0; \
|
||||
echo "==== compile attempt $i failed; wiping Yarn Classic cache and retrying ===="; \
|
||||
find /tmp -name pack.log -exec cat {} \; 2>/dev/null || true; \
|
||||
rm -rf /usr/local/share/.cache/yarn/* 2>/dev/null || true; \
|
||||
done; \
|
||||
echo "==== PACK LOGS (all attempts failed) ===="; \
|
||||
find /tmp -name pack.log -exec cat {} \; 2>/dev/null || true; \
|
||||
exit 1
|
||||
# Copy runit service startup scripts to its location
|
||||
# --------------------------------------------------
|
||||
ADD server-ce/runit /etc/service
|
||||
|
||||
Reference in New Issue
Block a user