Getting SonarQube into your pipeline is where it starts paying off - automated, repeatable and reviewed. Here is a working integration and the habits that keep it reliable.
A working pipeline snippet
Scan and fail on the Quality Gate.
- uses: sonarsource/sonarqube-scan-action@v3
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
- uses: sonarsource/sonarqube-quality-gate-action@v1Do this
- Enforce a 'new code' Quality Gate on every PR
- Wire coverage reports into the scan
- Triage security hotspots, don't blanket-ignore them
Avoid this
- Analyzing but not enforcing the Quality Gate, so nothing improves
- Chasing a green gate by disabling rules instead of fixing issues
- No coverage report wired in, so coverage looks like zero
Want senior help putting SonarQube to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.