简体   繁体   English

变化:Jenkins的质量门(声纳 - 跑步者)

[英]Change: Quality Gate from Jenkins (sonar-runner)

I am using Jenkins to kick off Sonar-runner for analyzing projects. 我正在使用Jenkins启动Sonar-runner来分析项目。

Now I use the Build Breaker plugin. 现在我使用Build Breaker插件。 This breaks a build when a quality gate is reporting that the quality is below/above given values. 当质量门报告质量低于/高于给定值时,这会打破构建。

I'd like to change the quality gate used by the Sonar-Runner, on a per-job basis in Jenkins. 我想在Jenkins的每个工作岗位上更改Sonar-Runner使用的质量门。 Looking up at Analysis Parameters documentation: 查看Analysis Parameters文档:

**sonar.profile** parameter is to change the language to analyse

I would thought that for the gate: sonar.gate would work (it doesn't) 我认为对于门: sonar.gate会工作(它没有)


Question: 题:

What parameter for sonar-runner has to be used to change the "Quality Gate"? 什么参数的声纳 - 跑步者必须用来改变“质量门”?

Used versions: 二手版本:

  • Jenkins 1.598 詹金斯1.598
  • Sonar 4.5.1 (LTS) 声纳4.5.1(LTS)

The property is sonar.qualitygate . 该物业是sonar.qualitygate

It was not documented because this is generally not a good idea to change the quality gate that should be used during a standard analysis - but it's true that it can be useful with the build breaker on preview analyses. 它没有记录,因为改变标准分析期间应该使用的质量门通常不是一个好主意 - 但是它确实对预览分析中的构建断路器很有用。

I updated the documentation. 我更新了文档。

I tried above solution but it did not work for me. 我试过上面的解决方案,但它对我不起作用。 Finally I figured out that with new version of sonar-scanner we can achieve it only from Sonar-Qube UI. 最后我发现,使用新版本的声纳扫描仪,我们只能从Sonar-Qube UI实现。 Follow below steps: 请遵循以下步骤:

  1. Login to Sonar Quber server as administrator and select projects. 以管理员身份登录Sonar Quber服务器并选择项目。 Search for the project name you want to add the quality gate for. 搜索要为其添加质量门的项目名称。 Select the searched project and below screen screen would appear. 选择搜索到的项目,将出现以下屏幕屏幕。
    在此输入图像描述

  2. Navigate to Administration > Quality Gates 导航到管理>质量门
    在此输入图像描述

  3. Select the quality gate from the drop-down which you want to use for this project (A default quality gate is assigned by-default for all the projects). 从下拉列表中选择要用于此项目的质量门(默认情况下,为所有项目分配默认质量门)。

    在此输入图像描述

Hope this helps. 希望这可以帮助。 Thanks! 谢谢!

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

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