Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Have buildbot poll a git repository for new commits?

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

like image 959
dbr Avatar asked Mar 14 '09 05:03

dbr


2 Answers

Update: The kind folks at the Buildbot project have made the GitPoller an official Change Source as of version 0.8.2, and made several improvements to the original.


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 :)

like image 67
jtomson Avatar answered Oct 14 '22 03:10

jtomson


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.

like image 44
Pat Notz Avatar answered Oct 14 '22 03:10

Pat Notz