Hi all I'm on linux and want to run sonarqube locally and based on the analysis result get exit code
- So for example if 0 errors in code analysis then exit code 0
- If it has 1 or more error in code analysis then exit code != 0
I run SQ server from docker-compose like this:
version: "3"
services:
sonarqube:
container_name: sonarqube
image: sonarqube:latest
ports:
- "9000:9000"
- "9092:9092"
and then with node I run sonarqube-scanner
:
const sonarqubeScanner = require('sonarqube-scanner');
sonarqubeScanner({
serverUrl: 'http://localhost:9000',
options : {
'sonar.sources': '.',
'sonar.inclusions' : 'src/**',
}
}, () => {});
Finally I get success on console but no exit codes:
INFO: CPD Executor 4 files had no CPD blocks
INFO: CPD Executor Calculating CPD for 3 files
INFO: CPD Executor CPD calculation finished (done) | time=11ms
INFO: Analysis report generated in 74ms, dir size=97 KB
INFO: Analysis report compressed in 46ms, zip size=21 KB
INFO: Analysis report uploaded in 34ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard?id=foobar
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://localhost:9000/api/ce/task?id=example
INFO: Analysis total time: 18.668 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 19.616s
INFO: Final Memory: 12M/50M
INFO: ------------------------------------------------------------------------
[11:10:42] Analysis finished.
question from:
https://stackoverflow.com/questions/65832029/is-it-possible-to-get-sonarqube-8-6-exitcode-from-terminal-based-on-analysis-res 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…