We use API qualitygates/project_status to grep status of quality gates and send email notiffication if quality gates --> if (qgate != ‘OK’)
but the API i thinks checking the previous analysis so it’s parsing false status
for examples
11:32 AM Version: 1.0
11:31 AM Quality Gate: Green (was Red)
we just run analysis on 11:32 but the history has two analysis and the api result give wrong status (not OK) but if i browse the analysis it’s show the quality gates is passes
Hi,
Are you waiting for that last analysis to be processed?
It might take several minutes for the quality gate to be updated after the scanner runs.
At the time you see the quality gate green in dashboard, project_status should also be returning it green (that’s how the dashboard gets the information!)
If i check further the false api status is send if there’s a change from red - green,
so previous scan result is red then we do mitigation then run analysis again and the status now is pass but the api result still send the red status.
The scanner writes in a file report-task.txt that is in the scanners Working Directory and contains a URL to get the background task status. For example, ceTaskUrl=http://{server-url}/api/ce/task?id=AXIPoFlQOQOkc-vr_dd5. Your script should use this to check if the background task finished before checking the project’s quality gate.
I added the script to check the background job and rerun the test but it’s still parsing the wrong status,
after i check further , the sonarqube create two different project analysis (althougt the project key was same,i wonder why sonarqube create two project analysis although the project key was same (maybe because there’re different branch?
Just to clarify, when you say that SonarQube creates two different project analysis, do you mean you have 2 different projects showing up in SonarQube? If that’s the case, there’s no way they have the same key.