如何自动更改质量门? [英] How to automatically change the Quality Gate?
问题描述
我们使用Jenkins作为CI服务器,并使用Sonarqube进行代码分析.
We are using Jenkins as our CI server, and Sonarqube for code analysis.
当前,我们正在使用SonarQube 4.5.7,我们想升级到6.5版.我们有几个质量关卡,但找不到自动方式将质量关卡分配给项目.
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.
在以前的版本中,我们使用了sonar.QualityGate
属性,但是现在不推荐使用此属性.
In previous version we used the sonar.QualityGate
property, but this property is now deprecated.
我们如何让Jenkins在开始分析之前设置质量门?
How can we let Jenkins setup the quality gate before it starts the analysis?
推荐答案
使用sonar.branch
属性运行分析分支.我猜(未经测试)主要项目的质量门将适用.
Use the sonar.branch
property to run branch the analysis. I guess (not tested) that the main project's quality gate will apply.
如果由于某种原因这不是一个选择,请使用curl
设置项目并设置质量门:
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
这篇关于如何自动更改质量门?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!