问题描述
如何从脚本动态分配Quality Gate进行项目投影. [SonarQube 6.5]
How to assign Quality Gate dynamically to project from the script. [SonarQube 6.5]
我尝试使用"sonar.qualitygate",但没有得到警告.
I tried with 'sonar.qualitygate' but got below warning.
谢谢.
[WARNING] Property 'sonar.qualitygate' is not supported any more. It will be ignored.
推荐答案
您可以在脚本中使用sonarqube Web API来设置项目的质量门.
You can use sonarqube Web API in your script to set the quality gate for your project.
首先,您需要获取要设置的质量门的ID.您可以使用Web API来获取可用的质量门及其相应ID的列表.
First, you need to get the id of the quality gate that you want to set. You can use the web API to get the list of quality gate available and their corresponding id.
curl -u "<Username>:<Password>" -X GET "http://localhost:9000/api/qualitygates/list"
现在,使用下面的Web API设置特定项目的质量门.
Now, use the below web api to set the quality gate to the specific project.
curl -u "<Username>:<Password>" -X POST "http://localhost:9000/api/qualitygates/select?projectKey=webapp&gateId=10180"
在这里,您可以分别根据项目和质量门ID(从上述api获取)来更改projectKey和gateId.
Here, you can change the projectKey and gateId according to your project and quality gate Id (you get from above api) respectively.
请在以下屏幕快照中找到更多信息:
Please find more information here in the screenshot:
这篇关于如何从脚本[SonarQube 6.5]动态分配Quality Gate到项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!