简体   繁体   中英

How to automatically change the Quality Gate?

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

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