ci: fail the sonarcloud job when the quality gate fails - #233
Merged
Merged
Conversation
Signed-off-by: Nacho Vazquez <nacho@naxo.dev>
|
View your CI Pipeline Execution ↗ for commit b6cedd4
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
|
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.



TL;DR
The SonarCloud job passes the moment the report finishes uploading, so the GitHub check said green while the quality gate sat at
ERRORonmain— undetected since 2020. Settingsonar.qualitygate.wait=truemakes the scanner poll for the verdict and exit non-zero when the gate fails.Follow-up to #232, which cleared the 22 code smells that had the gate red. Gate on
mainis nowOKwith 0 failing conditions, so this flag lands green.Why
sonarqube-scan-actionuploads the analysis and returns. Computing the gate happens server-side afterwards, and nothing was reading the result — the check reported on the upload, not the verdict. Any gate regression was invisible in CI and only discoverable by opening the SonarCloud dashboard.OKERRORonmainERRORon a PRReviewer notes
sonar-project.properties, not the workflow. It applies to every analysis — pull request andmain— rather than only the one CI step, and it lives beside the exclusions it interacts with.new_*conditions on pull requests, so this blocks a PR that introduces smells without holding it responsible for pre-existing ones.Ngworkers Quality Gate(id 40275) still judges overall code viacode_smells > 0andsqale_index > 0. Those are satisfiable today at 0, but three of the five smells fixed in chore: clear sonarcloud code smells failing the quality gate #232 appeared purely from analyzer upgrades, with no code change. The next such release turns a red gate into a redmain. Dropping both conditions —new_code_smells > 0already covers what matters — needs org-admin access in the SonarCloud UI and is the recommended companion to this PR.Tests
Config-only. Verified
configure-sonar-report-paths.mjsstill rewrites both placeholders with the new property present, andnx format:checkis clean. The real proof is this PR's own SonarCloud check, which now reflects the gate rather than the upload.Links