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

Описание к видео How to Create Quality Gate in SonarQube and Automate build to pass or fail using Jenkins Pipeline

https://www.coachdevops.com/2021/01/h...

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:

Комментарии

Информация по комментариям в разработке