Running Pull Request Builds with Jenkins
There are a few moving parts here:
- Projects on GitHub
- Jenkins server already available http://jenkins.joind.in
- GitHub’s commit status API to allow hooking of things into the pull request workflow
- The GitHub Pull Request Builder Plugin for Jenkins, it’s this that does most of the work.
We have our build tasks described with phing, so we created new Jenkins jobs to wrap the same phing task that we use for building the project but configured to accept the specific commits that were coming in via pull request. When the new pull request gets opened, it immediately shows up something like this:
And when it’s good to go:
It’s super-helpful to see if a test will fail on our build platform, or if there’s a syntax or coding style problem – and it gives immediate, quality-oriented feedback to all our contributors. I’d definitely want to use this again with other teams so I thought I’d mention it here.
Also related: A very useful post that we referred to when setting this up, which you can find at http://blog.kabisa.nl/2013/11/05/building-github-pull-requests-with-jenkins/
Hi Lorna!
What protection is there on the build server when running tests? That is – protection from people submitting malicious pull requests that do ugly stuff?
It respects a few named users and will build their pull requests. Those people can then request builds on other pull requests and add trusted people to a whitelist where all their pull requests will get built automatically. Good question!!
Just to note, you don’t need Jenkins to get this level of awesomeness, I get the same results using Travis-CI.org, which while it’s not quite as awesome as Jenkins, for a small open-source project with a low number of contributors, it’s probably just as good.
Yeah I think most people do this with Travis but I wanted to specifically cover Jenkins here. I didn’t make it clear in the post though so thanks for pointing it out
Sorry but this link is wrong..
Thanks!