2

I'm trying to write a pipeline as a code and in this pipeline I want to return the result of sonarqube analyze and do a filter if the general note is >=97 continue if it is less return a Notif in slack. but how can I return a result a of sonarqube

G. Ann - SonarSource Team
  • 22,346
  • 4
  • 40
  • 76
Mehdi Bouzar
  • 55
  • 1
  • 6
  • Just to clarify do you mean to read the result been published to sonarcube for a particular project before and after ? – anshul Gupta Jul 03 '17 at 11:52
  • yes but after .I want to retrieve the general note of an analysis to make a filter on the note exemple : (if "note"> 95 ... else ....) . i want to integrate the if bloc in jenkins pipeline – Mehdi Bouzar Jul 03 '17 at 14:01

1 Answers1

4

There are so called quality gates in Sonarqube which can be configured to fail the build if necessary.

You will have to configure a webhook between Sonarqube and Jenkins so that you pipeline can ask for the quality gate status. Further information can be found here: https://jenkins.io/doc/pipeline/steps/sonar/

Note: Especially have a look at the method waitForQualityGate() which does exactly what you intend to do!

arifCee
  • 509
  • 2
  • 12