How to Create Quality Gate in SonarQube and Automate build to pass or fail using Jenkins Pipeline
ฝัง
- เผยแพร่เมื่อ 3 ต.ค. 2024
- www.coachdevop...
SonarQube allows you to create quality gate to force the build to fail if some conditions are not met during code analysis.
What we will learn in this lab?
1. Learn how to setup a quality gate in SonarQube
2. How to force the build to fail in Jenkins when quality gate conditions are met?
Quality gates
In SonarQube a quality gate is a set of conditions that must be met in order for a project to be marked as passed.
Let us learn how to create quality gates in SonarQube and integrate with Jenkins during code scan.
Pre-requisites
Jenkins is up and running
SonarQube is up and running
Jenkins and Sonarqube already integrated
Login to SonarQube, Click on Quality gate, enter some name
Once you create the quality gate. Click on Add condition.
Select new bugs from the drop down and enter 1 as error
Choose your Web App, by clicking on App. and select My WebApp
Setup a Default Gate
Configure webhooks in SonarQube
Click on Administration -- Configuration -- Webhooks
Enter Jenkins URL
Now to go Jenkins, create a pipeline job:
Very useful. Thanks 😇
Glad it was helpful!
can you show us how to integrate Selenium and other testing frameworks with Jenkins? Also, show us how an application can be deployed from Dev-> test -> Stage->Prod from end to end?
Watch my other pipeline videos to learn how to deploy into multiple environments in Jenkins. th-cam.com/video/f0Rbk1iVhnc/w-d-xo.html
very nice but the audio was not audible
Hi, I tried. Quality gate shows failed. Finally I found webhook at Sonarqube not shows delivered.
super!!!
Thank you! Cheers!
How to do same for Github Actions?
I already have a video for this :) in my channel --> th-cam.com/video/JocHmIZ9c_U/w-d-xo.html
@@DevOpsCoach Thanks for reply :)
You welcome 🙏
You created a global hook, will this not fail the build for another project scan?
Hey I have install quality gate plugin ,sonar scaner is working fine but this quality gate is not working .even I have set sonar webhook from server
Review the configuration, also how did you set up quality gate?