1
  • Jenkins version:2.204.3
  • Sonarqube version:7.9.2
  • sonar-gerrit plugin: 2.30

I meet a issue:starting Sonarqube 7.7 in the preview mode (-Dsonar.analysis.mode=preview) was removed, making it incompatible with the plugin.

How can I fix this issue without downgrading sonarqube version and upgrading Jenkins version?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
JainPing
  • 75
  • 1
  • 7

1 Answers1

1

It's possible to do the following procedure:

  1. Execute the analysis (as usual)

  2. Download the report using the REST API

  3. Generate the sonar-report.json local report using a "jq" script

  4. Call the Sonar-Gerrit plugin (as usual)

This is the command for steps 2 and 3:

curl --user USER:PASS --header 'Content-Type:application/json' --request GET "https://SONAR-SERVER/api/issues/search?componentKeys=PROJECT-KEY&branch=BRANCH&resolved=false" | jq -f sonar-report-builder.jq > sonar-report.json

You can find the sonar-report-builder.jq file used in step 3 and more information about this issue here.