简体   繁体   中英

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]

I tried with 'sonar.qualitygate' but got below warning.

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.

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. 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"

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"

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: 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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