git-pull-request-builder

Configure Git Pull Request Builder on Jenkins (AWS)

Git Pull Request Builder plugin is used when a new pull request is opened in the project and the author of the pull request isn’t white-listed, builder will ask “Can one of the admins verify this patch?”.

  • “ok to test” to accept this pull request for testing
  • “test this please” for a one time test run
  • “add to whitelist” to add the author to the whitelist

If the build fails for other various reasons you can rebuild.


  • “retest this please” to start a new build

Git Pull Request Builder gives more authority and control over your code versioning, to configure this in Jenkins on Amazon Linux instance follow below steps..

Pre-requesites: 

  • I recommend to create GitHub ‘bot’ user that will be used for communication with GitHub (however you can use your own account if you want).
  • The user needs to have push rights for your repository (must be collaborator (user repo) or must have Push & Pull rights (organization repo)).
  • If you want to use GitHub hooks have them set automatically the user needs to have administrator rights for your repository (must be owner (user repo) or must have Push, Pull & Administrative rights (organization repo)). Refer following article to create a webhook : http://bhargavamin.com/how-to-do/setup-github-webhook-jenkins-amazon-linux-aws/

Install the plugin on Jenkins

Step 1. Install Plugin

Go to “Manage Jenkins“ -> “Manage Plugins“ -> “Available Plugin“ section, search GitHub pull requests builder and install it.

Step 2. Once you have installed plugin now lets configured it

Go to “Manage Jenkins“ -> “Configure System“ -> “GitHub pull requests builder“ section.

configure-git-pull-request-Git-Pull-Request-Builder

  • GitHub Server API URL: leave it as it is..
  • Jenkins URL overide : you can modify this only when you have proxy on your webserver else leave it blank
  • Credentials : Add GitHub usernames of admins (these usernames will be used as defaults in new jobs). 
  • Once credentials are added you can test credentials inorder to ensure those have proper rights are permission

config-test-credentials-Git-Pull-Request-Builder

  • Check Auto Manage Webhooks options
  • Only if you want custom configs then only edit below options or else save and exit the window.

Optional settings : 

  • Under Advanced, you can modify:
    • The phrase for adding users to the whitelist via comment. (Java regexp)
    • The phrase for accepting a pull request for testing. (Java regexp)
    • The phrase for starting a new build. (Java regexp)
    • The crontab line. This specify default setting for new jobs.
  • Under Application Setup
    • There are global and job default extensions that can be configured for things like:
      • Commit status updates
      • Build status messages
      • Adding lines from the build log to the build result message
      • etc.

Note make sure you have added Github username and password in GitHub Server section and test it so that triggers from Jenkins could reach Github :

github-server-setting

 

That’s it!

You’ve configured Github pull request builder plugin which can be used to handle webhooks triggers and can be integrated with other plugins.

If you have any doubt feel free to comment below.

-Bhargav

References: https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin