Repository navigation
fix(docker): ship .editorconfig into the API image build - #836
Merged
Merged
Conversation
The Devtron API image fails at the publish step with 56 Sonar analyzer errors (S3928, S3267, S1066, S125, S1694, ...). The root .editorconfig — the only place those rules are reviewed and waived to severity=none — was absent from the Docker build context (deny-all .dockerignore) and never copied by apps/api/Dockerfile, so the image compiled against Sonar defaults while SharedKernel sets TreatWarningsAsErrors=true. Allowlist .editorconfig in .dockerignore and COPY it into the api build stage workdir (/src), where Roslyn discovers it as an ancestor of Source/**. Lock the invariant with a CI test mirroring the pnpm-patches guard. Verified with full docker builds of the `build` stage: - original files: 56 analyzer errors, exit 1 (matches the Devtron log) - with fix: publish succeeds, exit 0
There was a problem hiding this comment.
🟡 Changes recommended
The regression assertions permit invalid copy destinations and do not verify the required analyzer rules individually.
2 open findings
What changed in this PR
Ships the root .editorconfig into API Docker builds so Roslyn applies repository Sonar severity overrides.
Changes:
- Allow
.editorconfigthrough the deny-all Docker context. - Copy it into the API build stage.
- Add CI regression checks.
| File | Description |
|---|---|
.dockerignore |
Allowlists .editorconfig. |
apps/api/Dockerfile |
Copies analyzer configuration into /src. |
.github/workflows/pr-verify.yml |
Runs the new regression tests. |
scripts/ci/tests/dockerignore-api-analyzer-config.test.mjs |
Verifies Docker analyzer configuration invariants. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| assert.ok(buildStage, "apps/api/Dockerfile must declare a `build` stage"); | ||
| assert.match( | ||
| buildStage[1], | ||
| /COPY\s+\.editorconfig\s+\.\//, |
Comment on lines
+82
to
+87
| const downgraded = [ | ||
| ...editorconfig.matchAll(/^\s*dotnet_diagnostic\.(S\d+)\.severity\s*=\s*none/gm), | ||
| ]; | ||
| assert.ok( | ||
| downgraded.length >= 50, | ||
| `expected the root .editorconfig to waive >=50 Sonar rules, found ${downgraded.length}`, |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 15 |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Cherry-pick of #835 (→ main). Same latent bug: deny-all .dockerignore + apps/api/Dockerfile never provide .editorconfig, so Devtron API builds fail on 56 default-severity Sonar errors. Details and docker-build evidence in #835.