Change: Quality Gate from Jenkins (sonar-runner)

14,677

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.

Share:
14,677

Related videos on Youtube

TheMiXeD
Author by

TheMiXeD

Updated on September 17, 2022

Comments

  • TheMiXeD
    TheMiXeD about 1 year

    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)
  • TheMiXeD
    TheMiXeD almost 9 years
    Thanks for the feedback: It won't work with spaces inside the qualitygate name i try using " ",' ',_ and nothing all giving can't find qualitygate. When i did manage to change the qualitygate it doesn't show the last used qualitygate on the Dashboard.
  • Fabrice - SonarSource Team
    Fabrice - SonarSource Team almost 9 years
    If your quality gate has a space (for instance "My Gate"), you just have to encode the space character (i.e. "My%20Gate").
  • TheMiXeD
    TheMiXeD almost 9 years
    For selecting a profile there was a solution to use "I do like spaces". And for the dashboard not showing the last used qualitygate?
  • Fabrice - SonarSource Team
    Fabrice - SonarSource Team almost 9 years
    That's weird, you should create a new question and paste the logs there so that I can check.
  • TimP
    TimP over 8 years
    Using 4.4.1 it complains if the qualitygate named does not exist, but if it does exist then that is not set on the project.
  • Jerry
    Jerry almost 8 years
    Can the current docs be updated to mention this setting? It's a useful feature for analysis run on temporary branches of source code. Sonar project is created when Git branch is created and both are deleted when branch is merged into master. In our use case we don't want devs to manually set the quality gate for each branch, config setting is ideal in our case. For anyone else looking for the docs mention, they're only in the 5.0 version docs.sonarqube.org/display/SONARQUBE50/Analysis+Parameters
  • ravikanth
    ravikanth over 7 years
    The log showed it is loaded a custom quality gate; but it really did not, sonar ui so it used the default quality gate.