Skip to content

fix(docker): ship .editorconfig into the API image build - #836

Merged
tolstenko merged 1 commit into
developfrom
fix/api-docker-editorconfig-develop
Oct 13, 2026
Merged

tolstenko merged 1 commit into
developfrom
fix/api-docker-editorconfig-develop

Conversation

@tolstenko

Copy link
Copy Markdown
Contributor

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.

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
Copilot AI balanced review requested due to automatic review settings October 13, 2026 00:58
@cla-bot cla-bot Bot added the cla-signed label Oct 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 .editorconfig through 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}`,
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 15 complexity

Metric Results
Complexity 15

View in Codacy

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.

@tolstenko
tolstenko merged commit a9a78bc into develop Oct 13, 2026
25 checks passed
@tolstenko
tolstenko deleted the fix/api-docker-editorconfig-develop branch October 13, 2026 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants