How to Create Quality Gate in SonarQube and Automate build to pass or fail using Jenkins Pipeline

preview_player
Показать описание

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 nice but the audio was not audible

kishoregowrish
Автор

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?

master
Автор

Hi, I tried. Quality gate shows failed. Finally I found webhook at Sonarqube not shows delivered.

venkateshd
Автор

You created a global hook, will this not fail the build for another project scan?

ghosteng
Автор

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

bijayajena