views:

944

answers:

4

Is there a buildbot plugin that will poll a git repository for new commits, like the currently included changes.SVNPoller?

The closest I have found is git_buildbot.py, but it works as a post-commit hook, so will not work with my setup (using Github, and buildbot on a machine that github's post-commit cannot reach) - simply polling the git repository would work perfectly.

I currently have a build run once an hour, but there's not really any point in running the tests unless something has changed..

+1  A: 

I've not played with buildbot at all but couldn't you do a git fetch and then look at the output of git log master..origin/master? If there are no new commits then the output will be empty (there are, of course, a ton of other options you can use on git log). If there are new commits then just do a git merge and start your build/test cycle.

Pat Notz
+5  A: 

Better late than never... I just blogged about GitHub service hook I wrote about for BuildBot.

You can find it here: http://app.arat.us/blog/?p=136

roder
+3  A: 

Our company is in a similar situation where our build machines cannot be reached by GitHub's post-commit hook. I've written a GitPoller change source that can be used like the SVNPoller.

It can be found here: http://github.com/wimba/buildbot/blob/master/buildbot/changes/gitpoller.py

and used like this:

from buildbot.changes.gitpoller import GitPoller
c['change_source'] = GitPoller('[email protected]:foobaz/myrepo.git',
                               branch='great_new_feature')

It will create a local repo to work out of (location configurable), and it's only been tested with git 1.7 so your mileage may vary.

Hopefully it will be pulled into the Buildbot project proper at some point, but it's been working for us so far and hoping it may be of use to others :)

liftedelm
A: 

I like the gitpoller.py approach but at the moment I found it a bit limited (e.g. does not send revisions, project arguments) so found a different solution:

I have my own repository cloned from the remote and git_buildbot.py called by the post-merge hook (as described in git_buildbot.py). I have a small loop sleeping and git pulling in that repo which will trigger the post-merge hook.

Russell Gallop