简体   繁体   中英

Change: Quality Gate from Jenkins (sonar-runner)

I am using Jenkins to kick off Sonar-runner for analyzing projects.

Now I use the Build Breaker plugin. 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. Looking up at Analysis Parameters documentation:

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

I would thought that for the gate: sonar.gate would work (it doesn't)


Question:

What parameter for sonar-runner has to be used to change the "Quality Gate"?

Used versions:

  • Jenkins 1.598
  • Sonar 4.5.1 (LTS)

The property is 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. Follow below steps:

  1. Login to Sonar Quber server as administrator and select projects. 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!

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