DEPRECATED. BUILDS ARE NOW CONFIGURED IN https://builds.apache.org/view/J/view/jclouds/
Overview
Setting up a Jenkins job in the jclouds DEV@cloud account to trigger on Pull Requests is a three-step process:
- Configure the Jenkins job in DEV@cloud
Create the Service Hook in GitHub
Configure the Service Hook via the GitHub API
Prerequisites
DEV@cloud Account
If you don't have a DEV@cloud account with rights to create Jenkins jobs for jclouds, plesae send an email to the dev list requesting access.
Admin Rights in GitHub
You'll need to be able to administer the GitHub repo for which you're looking to create a pull request job. If you can see the Settings link for the repo, you should be OK.
Configuring the Jenkins Job
Log in to the jclouds DEV@cloud account and create a new job on the pull requests tab. Your best bet is to clone of the existing pull request jobs and modify the source repository.
There are three things you need to ensure:
- The source repository and branch are correct
Git validated merge support is enabled
Build pull requests to the repository is the only build trigger
Creating the GitHub Service Hook
Go to the Settings > Service Hooks menu and create a new WebHook URLs entry pointing at https://jclouds.ci.cloudbees.com/github-pull-request-hook/
Configuring the Service Hook
Unfortunately, the Service Hook we have just created listens to the wrong repository event (push instead of pull_request) and sends the wrong type of data, and that's not (yet) something we can change via the GitHub site. We'll use the GitHub HTTP API instead.
Download the attached json-body.txt
Find the URL of the hook to be modified by running
curl -k -u <your-github-user>:<your-github-pass> https://api.github.com/repos/<github-account>/<repo>/hooks
e.g. curl -k -u myuser:secret https://api.github.com/repos/jclouds/jclouds-labs/hooks. Look for the id of the hook whose config > url attribute is https://jclouds.ci.cloudbees.com/github-pull-request-hook/
Update the hook by running
curl -k -u <your-github-user>:<your-github-pass> -d @<path-to-downloaded-json-body> -X PATCH https://api.github.com/repos/<github-account>/<repo>/hooks/<id-from-step-2>
e.g. curl -k -u myuser:secret -d @/tmp/json.body -X PATCH https://api.github.com/repos/jclouds/jclouds-labs/hooks/1234567
The output of the last command should be something like
{ "url": "https://api.github.com/repos/jclouds/jclouds/hooks/123456", "test_url": "https://api.github.com/repos/jclouds/jclouds/hooks/123456/test", "id": 123456, "name": "web", "active": true, "events": [ "pull_request" ], "config": { "url": "https://jclouds.ci.cloudbees.com/github-pull-request-hook/" }, "last_response": { "code": 200, "status": "ok", "message": "OK" }, "updated_at": "2013-06-25T04:50:23Z", "created_at": "2013-05-22T09:20:48Z" }