Plugins currently being used in Jenkins for Pull Requests.
- CloudBees Pull Request Builder for GitHub - This is the one to use and configure moving forward for non pipeline-based jobs
- GitHub Branch Source Plugin - Should be used for multibranch pipelines
- 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
- Check "Enable Git validated merge support" and "Build pull requests to the repository" in your build config
- Webhooks should go through the relay, in the past you had to:
- Create two webhooks (this should be automatic, but it might not be) on your GH repo
- https://builds.apache.org/github-pull-request-hook/ (pull_request)
- https://builds.apache.org/github-webhook/ (push)
- Add asfbot as a Collaborator and set it to Admin
- 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.
- Kick off a PR
- 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
- Click "New item" and select "Multibranch Pipeline" as type
- In Job Configuration select "GitHub" as branch source, select credentials "ASF Cloudbees Jenkins ci-builds" and enter your GitHub HTTPS URL
- Kick off a PR
- 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)
- Check "GitHub Pull Request Builder" on your build config
- Credentials should be auto populated, but set to api.github.com pre commit token
- Admin should include those who you'd like to be able to kick off builds, needs to be at least asfbot
- Check "Use github hooks for build triggering" this will auto create a webhook in GitHub
- Set a trigger phrase, such as "retest" or "rebuild" so you can kick off another build via comments
- Various other fields can be configured, but it all depends on what you want to do
- Example config https://builds.apache.org/view/All/job/POI-Github-PullRequests/configure