Repository navigation
fix(docker): allowlist patches/ so pnpm patchedDependencies resolve in web build - #833
Conversation
…n web build The Devtron web image build fails at the deps stage: ENOENT: no such file or directory, open '/repo/patches/braces@3.0.3.patch' exit code: 254 .dockerignore is deny-all (`**/*` plus an allowlist) and never allowed patches/. `turbo prune --docker` therefore runs without the patch files, so it omits them from out/json, and the subsequent `pnpm install --frozen-lockfile` cannot resolve the patchedDependencies declared in pnpm-workspace.yaml. Allowlist patches/ and lock the invariant with a CI test that fails if any declared or lockfile-referenced patch path is excluded from the build context.
There was a problem hiding this comment.
🟡 Changes recommended
The regression guard can miss declared patches and provides incorrect remediation guidance.
3 open findings
What changed in this PR
Restores pnpm patch availability during Docker web builds and adds regression coverage.
Changes:
- Allowlists
patches/in the Docker context. - Adds an always-on CI invariant test.
| File | Description |
|---|---|
.dockerignore |
Includes pnpm patch files. |
.github/workflows/pr-verify.yml |
Runs the new invariant test. |
scripts/ci/tests/dockerignore-pnpm-patches.test.mjs |
Validates patch configuration and Docker access. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // pnpm v10 keeps patchedDependencies in the root pnpm-workspace.yaml (pnpm v9 | ||
| // kept them in the root package.json `pnpm` key). Accept either location so the | ||
| // test survives the config move. | ||
| const readPatchedDependencies = () => { |
|
|
||
| // The pruner `COPY . .` only sees files the .dockerignore allows, and turbo's | ||
| // out/json tree preserves each patch at its repository-relative path. | ||
| for (const patchPath of Object.values(patched)) { |
| `.dockerignore excludes it. Add \`!patches\` (and keep it above the ` + | ||
| `deny-all \`**\`) so turbo prune emits it into out/json.`, |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 18 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Production-down blocker: the Devtron web image build fails post-#696 merge ( |


Problem
After the develop→main merge (#696), the Devtron web image build fails at the
depsstage:Root cause
.dockerignoreis deny-all (**/*plus an allowlist) and never allowlistedpatches/. The failure chain:prunerstage:COPY . .is filtered by.dockerignore→patches/never enters the build context.turbo prune --dockeronly emitspatches/intoout/jsonwhen the files exist in that context — they don't, so it omits them (verified: prune on a tree withoutpatches/producesout/jsonwithoutpatches/whilepackage.jsonstill references the patch paths).depsstage:pnpm install --frozen-lockfilereadspatchedDependencies(pnpm-workspace.yaml + pnpm-lock.yamlpath:entries) → ENOENT, exit 254.patches/was introduced Oct 5 (braces CVE patch,8ddfb2d656); the deny-all.dockerignorepredates it (Sep 29) — a latent regression that surfaced the first time the tree was built post-merge.Fix
.dockerignore: allowlistpatches(one line,!patches— Docker semantics: re-including the dir re-includes its files).Verification (real docker builds,
--no-cache)origin/maindeps(pnpm install --frozen-lockfile)out/json/patches/.patchfiles presentRegression guard
scripts/ci/tests/dockerignore-pnpm-patches.test.mjs(wired into the always-onclassifyjob in pr-verify):patchedDependenciespath (pnpm-workspace.yaml, pnpm v10 location; falls back to root package.json) must be allowed by.dockerignorepnpm-lock.yamlmust stay in sync and reachableVerified the test fails on the broken state (with actionable message) and passes on the fix.
Note: same latent bug exists on
develop— will cherry-pick there after this lands.Pre-existing local-only failures in
pull-ci-image.test.mjs(macOS bash 3.2unbound variable) are unrelated and green on CI.