0
votes

I'm working on a jenkins job without the possibility of using a pipeline.

What i need to do is to launch some sonarQube Analysis and to check if the quality gates has passed. If the analysis with the quality gate fails, i would like to block my job.

I know that i can do this by scripting a pipeline and i know how to do it, but in this particular case i cannot write a pipeline but i can use only the "Prebuild steps" and "After Build Steps" of the job. So my questions are:

  • Is possibile to implment the pipeline into the job that doesn't have the pipeline section?
  • how can i check if the analysis have passed the quality gate? I've also read about a Jenkins plugin called "Quality Gate", but it has a problem about security (credentials in plain text) so i think they will not allow me to use it.

Thanks everybody!

1

1 Answers

0
votes

In this case probably the easiest thing would be to instruct sonar-scanner to wait for quality gate result. From the documentation:

you can use the sonar.qualitygate.wait=true analysis parameter in your configuration file. Setting sonar.qualitygate.wait to true forces the analysis step to poll your SonarQube instance until the Quality Gate status is available. This increases the pipeline duration and causes the analysis step to fail any time the Quality Gate fails, even if the actual analysis is successful.