We are using Jenkins as our CI server, and Sonarqube for code analysis.
Currently we are using SonarQube 4.5.7 and we want to upgrade to version 6.5. We have several quality gates, and we can't find an automatic way to assign the quality gate to the project.
In previous version we used the sonar.QualityGate
property, but this property is now deprecated.
How can we let Jenkins setup the quality gate before it starts the analysis?
Use the sonar.branch
property to run branch the analysis. I guess (not tested) that the main project's quality gate will apply.
If that is not an option for whatever reason, use curl
to provision the project and to set the quality gate:
curl -s -u admin:admin -XPOST "localhost:9000/api/projects/create?project=b&name=bla" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/qualitygates/select?projectKey=b&gateId=1" | python -m json.tool