Plugins currently being used in Jenkins for Pull Requests.

  1. CloudBees Pull Request Builder for GitHub - This is the one to use and configure moving forward for non pipeline-based jobs
  2. GitHub Branch Source Plugin - Should be used for multibranch pipelines
  3. GitHub Pull Request Builder - SHOULD NOT BE USED for new builds. Migrate to one of the above plugins ASAP

CloudBees Pull Request Builder for GitHub

  1. Check "Enable Git validated merge support" and "Build pull requests to the repository" in your build config
  2. Webhooks should go through the relay, in the past you had to:
    1. Create two webhooks (this should be automatic, but it might not be) on your GH repo 
      1. https://builds.apache.org/github-pull-request-hook/ (pull_request)
      2. https://builds.apache.org/github-webhook/ (push)
  3. Add asfbot as a Collaborator and set it to Admin
  4. Set "Branches to build" → "Branch Specifier (blank for 'any')" to the branch you'd like to build. Careful: if you set it to any, then any comment/close/whatever will kick off a build. You can set this to */master, so any merged PR to master would kick off a build.
  5. Kick off a PR
  6. Example config https://ci-builds.apache.org/job/Directory/job/dir-scimple-pull-requests/configure

For multi-repo/catchall webhook setups (like sling-*.git), refer to relay.yaml in p3/modules/gitbox/files/conf for the multi-repo relay script.

This is also a very good write-up.

GitHub Branch Source Plugin

  1. Click "New item" and select "Multibranch Pipeline" as type
  2. In Job Configuration select "GitHub" as branch source, select credentials "ASF Cloudbees Jenkins ci-builds" and enter your GitHub HTTPS URL
  3. Kick off a PR
  4. Example config https://ci-builds.apache.org/job/Jackrabbit/job/filevault-package-maven-plugin/configure

Alternatively you can also scan the "apache" GitHub organization for repos matching a specific pattern like outlined in https://ci-builds.apache.org/job/Sling/job/modules/configure

GHPRB (deprecated, notes are for reference only)

  1. Check "GitHub Pull Request Builder" on your build config
  2. Credentials should be auto populated, but set to api.github.com pre commit token
  3. Admin should include those who you'd like to be able to kick off builds, needs to be at least asfbot
  4. Check "Use github hooks for build triggering" this will auto create a webhook in GitHub
  5. Set a trigger phrase, such as "retest" or "rebuild" so you can kick off another build via comments
  6. Various other fields can be configured, but it all depends on what you want to do
  7. Example config https://builds.apache.org/view/All/job/POI-Github-PullRequests/configure