Reputation: 73
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:
Thanks everybody!
Upvotes: 1
Views: 14578
Reputation: 4261
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. Settingsonar.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.
Upvotes: 6