I am executing the analysis of my project through gitlab-CI, I also use the file sonar-project.properties, at the end of the analysis, I use the api quality gates project_status to visualize the status of the analysis but it returns the NONE value despite that the analysis was successful (console result is displayed), when I run the api again, it responds OK.
Why is that behavior?
Welcome to the community!
There are two parts of analysis. On the analysis machine the source (and sometimes binary) files are analyzed and the result are bundled into an analysis report, which is submitted to the server.
Server-side, new analysis reports are queued, and processed in order. What you’re running into is the delay between the analysis-side completion and real completion server-side.
Rather than adding a wait to your script, take a look at the docs on reflecting QG status in your GitLab-CI pipeline.
Thank you very much for the help
Apply the recommended settings but sonar, you are not considering the parameter sonar.qualitygate.wait = true as it continues to answer none when I consume the api. There is another step you should take
Hi, could you please clarify to me what you are trying to achieve ?
I have a project developed in typescript, the analysis in sonarqube is done through a stage in gitlab-ci. Esete project, has the file sonar-project.properties which has the data required to create the project in sonarqube and be analyzed, at each stage execution, I consume the api to visualize the status of the project after being analyzed, when it is executed for the first time, the api returns the value none, if I run again it returns OK, add the parameters sonar.qualitygate.wait and sonar.qualitygate.timeout, however, it returns none the first time it is executed
I try to get the analysis result back from the first execution, since it currently returns none the first time it is run, I am using sonarqube 7.9.2 and sonar-scanner 4.2
Having results in the console of the CI does not mean that the analysis is complete. When the scanner is done, it send a payload to SonarQube and that create a background task that will be queued and executed by the SonarQube compute engine. That task need to be done before you can get the analysis result through api. Background task are documented here.
Thank you very much for the clarification, in this case, what should I do to wait for the task to finish and be able to consume the api with the status of the project ?, since the parameter -Dsonar.qualitygate.wait = true, does not perform the desired wait
Adding the sleep command, indicate a prudent wait time for the stage of my IC, to wait for it to finish generating the analysis results report.
Thank you very much for your comments