Wednesday, July 12, 2017

Sonar Analysis with Pull request Raise part 1.

Hello Guys,

In recent days one of my friend had ask me is it possible that when ever some one raise a pull request in the github repo.
ex. Assume i have  github repo called newrepo. Now whenever some one push his code into my repo I need to validate that code against some bench mark of quality and i also need to make sure that the code is of good quality and If it has any defect then I should get those in github comment on the pull request.
Its has to be done in  steps

  1. Create  a Github webhooks
  2. Generate personal access token with appropriate permissions .
  3.  Create a jenkins Job
  4. setup of Sonarqube
  5. Step up Quality gate for the Project (Optional)  
1. Create Github webhook.

In My case go to URL

Open your repository in that click on settings and in settings click on Webhooks or  goto URL.

Replace newrepo with the name of your project repository.

click on add a Webhook and fill the details of your Jenkins server as shown in the picture.

 This web-hook will send an information about the Pull request  and  to trigger a jenkins job we need to create one more web hook as shown in below screenshot

and Thats It We are done with part 1
In next part  I will setup jenkins and remaining configuration and sonar changes