Mehdi Bouzar
Mehdi Bouzar

Reputation: 55

return the results of sonarqube

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

Upvotes: 2

Views: 1350

Answers (1)

arifCee
arifCee

Reputation: 529

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!

Upvotes: 4

Related Questions