Have buildbot poll a git repository for new commits?
Asked Answered
P

3

8

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

Paederast answered 14/3, 2009 at 5:11 Comment(0)
T
9

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

Thacher answered 18/6, 2010 at 18:7 Comment(0)
A
1

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.

Aeneous answered 22/3, 2009 at 15:8 Comment(0)
Z
0

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.

Zoogeography answered 31/8, 2010 at 14:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.