Running Pull Requests from Hudson

Since the Andmore Project is using GitHub for our central repository, we needed a way to at least manually verify that a given pull request can build and not fail any existing tests. Unfortunately, unlike Jenkins, there currently is no GitHub integration plugin for running pull requests and then posting back the results to the particular pull requests.

However, you can setup a job on your HIPP instance so that you can run the pull requests manually and verify the results. To start with you’ll need a parameterized build on your HIPP instance. I suggest setting up a Parameter like PULLREQUEST_NUMBER as shown below.

Screen Shot 2015-02-12 at 2.54.50 PMThis will allow you to enter the Pull Request number when you manually or remotely trigger the job.

The next thing you need to do is to tell the git plugin how to find the pull request branches. You also need away to tell git what branch from those pull requests to check out when building.

Screen Shot 2015-02-12 at 2.55.15 PMThe keys here are the Refspec entry and the Branch Specifier.   When you kick off a job, it’ll use the Pull Request number you specified, and build that particular branch.

There is an existing bug report asking for enhanced and integrated support for Hudson and Pull requests with GitHub.   As more projects at the Eclipse Foundation start to use Git as the central repo, working with Pull Requests is going to become even more critical.  This at least gets you part of the way there so you can verify the requests with Hudson.

This entry was posted in android, build, eclipse, release engineering and tagged . Bookmark the permalink.

5 Responses to Running Pull Requests from Hudson

  1. Michael Keppler says:

    Why aren’t you using a webhook in github to trigger that build? In your repo admin section just add the URL of the Hudson job to be triggered as webhook, (maybe add a secret token as parameter to be verified in the build job to avoid someone exploiting this) and then get all the details about the pull request from the payload of the event.

    • kingargyle says:

      With the webhooks, GitHub only sends a JSON payload. There isn’t a way in the URL to specify the Pull Request Number. They used to allow you to do such a thing, but with the new WebHooks API it will always either send a JSON or XML payload to the end point in their particular format with the event information.

      My first thought was to use a WebHook that kicked off on the Pull Request event and only responded to the synchronize or open events

  2. Michael Keppler says:

    You could still run a simple script on a server (might even be a private one) to decode the JSON and call your URL afterwards. But I see that this is not as straightforward as I thought. I’m using the Jenkins plugin, and that hides much of the nasty things.

    • kingargyle says:

      Yeah, that is a work around I’m exploring with the Eclipse Foundation. The other option is for me to just try and backport the existing Jenkins plugin to work with Hudson. Maybe I’ll do I’ll try that on my plane trip out to EclipseCon next month.

  3. Pingback: Tracking Pull Requests on your HIPP instance | intellectualcramps

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s