Add jenkins job sonar scan into "Require branches to be up to date before merging"

332 Views Asked by At

I'm setting up Jenkins job sonarqube scan code in the github PR but I dont know how to integrate the name of jenkins job can define in "Require branches to be up to date before merging". My purpose is whenever new PR comes, sonarqube scans code before accept to merge or not.

Please let me know if you have any idea, thanks!

enter image description here

1

There are 1 best solutions below

0
David M. Karr On

I can't provide a full answer for you, but I'll clarify some of this.

None of these "branch protection rules" have anything to do with SonarQube scans.

Typically, you will want to configure your SCM repository system so that when a pull request is created, it spawns a Jenkins build, which can do whatever it needs to do, including running a SonarQube scan on the code in the pull request branch.

Github, like other similar repository technologies, will have a way to detect the creation of the pull request. That will include configuration of the Jenkins connection information. There are different ways of doing this.