Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jclouds Wiki" for 
change notification.

The "Creating a pull request job in DEV@cloud" page has been changed by 
AndrewPhillips:
https://wiki.apache.org/jclouds/Creating%20a%20pull%20request%20job%20in%20DEV%40cloud

New page:
= Creating a Pull Request Job in CloudBees =

== Overview ==

Setting up a Jenkins job in the jclouds 
[[https://jclouds.ci.cloudbees.com|DEV@cloud account]] to trigger on Pull 
Requests is a three-step process:

 1. Configure the Jenkins job in DEV@cloud
 2. Create the Service Hook in !GitHub
 3. 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 
[[http://incubator.apache.org/projects/jclouds.html|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 [[https://jclouds.ci.cloudbees.com|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:

 1. The source repository and branch are correct
 2. ''Git validated merge support'' is enabled {{attachment:image.png|Git 
validated merge support option|align="right"}}
 3. ''Build pull requests to the repository'' is the only build trigger 
{{attachment:image.png|Build pull requests to the repository 
trigger|align="right"}}

== 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.

 1. Download the attached JSON body[[attachment:example.pdf||&do=get]]
 2. 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/}}}
 3. 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"
}
}}}

Reply via email to