How to automatically change the Quality Gate?

假如想象 提交于 2019-12-12 20:37:20

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/46540956/how-to-automatically-change-the-quality-gate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!