简体   繁体   English

如何从脚本 [SonarQube 6.5] 动态分配质量门到项目?

[英]How to assign Quality Gate dynamically to project from the script [SonarQube 6.5]?

How to assign Quality Gate dynamically to project from the script.如何从脚本动态分配质量门到项目。 [SonarQube 6.5] [SonarQube 6.5]

I tried with 'sonar.qualitygate' but got below warning.我尝试使用 'sonar.qualitygate' 但低于警告。

Thanks in advance.提前致谢。

[WARNING] Property 'sonar.qualitygate' is not supported any more. It will be ignored.

You can use sonarqube Web API in your script to set the quality gate for your project.您可以在脚本中使用 sonarqube Web API 为您的项目设置质量门。

Note: You need the "Administer Quality Gate" permission to set the qualitygate.注意:您需要“管理质量门”权限才能设置质量门。

First, you need to get the id of the quality gate that you want to set.首先,您需要获取要设置的质量门的 ID。 You can use the web API to get the list of quality gate available and their corresponding id.您可以使用 Web API 获取可用的质量门列表及其对应的 id。

curl -u "<Username>:<Password>" -X GET "http://localhost:9000/api/qualitygates/list"

Now, use the below web api to set the quality gate to the specific project.现在,使用下面的 web api 为特定项目设置质量门。

curl -u "<Username>:<Password>" -X POST "http://localhost:9000/api/qualitygates/select?projectKey=webapp&gateId=10180"

Here, you can change the projectKey and gateId according to your project and quality gate Id (you get from above api) respectively.在这里,您可以分别根据您的项目和质量门 ID(您从上面的 api 获得)更改 projectKey 和 gateId。

Please find more information here in the screenshot:请在屏幕截图中找到更多信息: 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM