fix(ci): harden cron and Docker validation

This commit is contained in:
Peter Steinberger
2026-04-27 07:57:56 +01:00
parent 41268ded2d
commit 090063bd43
2 changed files with 17 additions and 3 deletions

View File

@@ -72,10 +72,20 @@ RUN --mount=type=cache,id=openclaw-pnpm-store,target=/root/.local/share/pnpm/sto
NODE_OPTIONS=--max-old-space-size=2048 pnpm install --frozen-lockfile
# pnpm v10+ may append peer-resolution hashes to virtual-store folder names; do not hardcode `.pnpm/...`
# paths. Fail fast here if the Matrix native binding did not materialize after install.
RUN echo "==> Verifying critical native addons..." && \
# paths. Matrix's native downloader can hit transient release CDN errors while
# still exiting successfully, so retry the package downloader before failing.
RUN set -eux; \
echo "==> Verifying critical native addons..."; \
for attempt in 1 2 3 4 5; do \
if find /app/node_modules -name "matrix-sdk-crypto*.node" 2>/dev/null | grep -q .; then \
exit 0; \
fi; \
echo "matrix-sdk-crypto native addon missing; retrying download (${attempt}/5)"; \
node /app/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/download-lib.js || true; \
sleep $((attempt * 2)); \
done; \
find /app/node_modules -name "matrix-sdk-crypto*.node" 2>/dev/null | grep -q . || \
(echo "ERROR: matrix-sdk-crypto native addon missing (pnpm install may have silently failed on this arch)" >&2 && exit 1)
(echo "ERROR: matrix-sdk-crypto native addon missing after retries" >&2 && exit 1)
COPY . .

View File

@@ -48,6 +48,10 @@ describe("Dockerfile", () => {
const dockerfile = await readFile(dockerfilePath, "utf8");
expect(dockerfile).toContain("Verifying critical native addons");
expect(dockerfile).toContain('find /app/node_modules -name "matrix-sdk-crypto*.node"');
expect(dockerfile).toContain(
"node /app/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/download-lib.js",
);
expect(dockerfile).toContain("matrix-sdk-crypto native addon missing after retries");
expect(dockerfile).not.toMatch(
/ADDON_DIR=.*node_modules\/\.pnpm\/@matrix-org\+matrix-sdk-crypto-nodejs@/,
);