Integrate Sonarqube 8.3 Quality Gate with GitLab

Afternoon ,

Using sonarqube 8.3 and Gitlab 11.10.8-ee with sonar-scanner-msbuild-4.10.0.19059-net46.

Is it possible to have the quality gate feed back the results to Gitlab CI via a flag/option for a msbuild sonar-scanner. As the the non-msbuild sonar-scanner seems to have the ability to fail a pipeline via

“sonar.qualitygate.wait=true”.

There are plugin options out there and of course I can roll my own solution.

But it would be nice if i could use a flag with the msbuild sonar-scanner.

Thanks,

Neil

Hi Neil,

According to the docs, you set that flag in your .gitlab-ci.yml file. … Do you not use that same file when analyzing with the SonarScanner for MSBuild?

 
Ann

Lovely stuff Ann, just found a quiet moment to test and it does indeed work by simply setting the following in the begin phase:

Sonarscanner.msbuild.exe begin /k:“xxxxx” /n:“xxxxxx” /d:sonar.qualitygate.wait=true /d:sonar.qualitygate.timeout=180

“INFO: ------------- Check Quality Gate status
INFO: Waiting for the analysis report to be processed (max 180s)
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 10.718s
ERROR: Error during SonarScanner execution
ERROR: QUALITY GATE STATUS: FAILED - View details on http://xxxxxxx
ERROR:
INFO: Final Memory: 23M/353M
INFO: ------------------------------------------------------------------------
The SonarQube Scanner did not complete successfully
09:07:59.127 Post-processing failed. Exit code: 1
ERROR: Job failed: exit status 1”

Just finding the msbuild documentaion a bit confusing.

Thanks Neil

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.