If you cannot take advantage of post-receive hooks as provided by
contrib/git_buildbot.py for example, then you can use the GitPoller.
The GitPoller periodically fetches from a remote git repository and
processes any changes. It requires its own working directory for operation, which
can be specified via the workdir property. By default a temporary directory will
be used.
The GitPoller only works with git 1.7 and up, out of the
box. If you're using earlier versions of git, you can get things to
work by manually creating an empty repository in
<tempdir>/gitpoller_work.
GitPoller accepts the following arguments:
repourlgit@example.com:foobaz/myrepo.git
(see the git fetch help for more info on git-url formats)
branch'master'
workdir<tempdir>/gitpoller_work, which is probably not what you want. If
this is a relative path, it will be interpreted relative to the master's
basedir.
pollIntervalgitbin'git'
fetch_refspecGitPoller will simply fetch all refs. If your repository is large
enough that this would be unwise (or active enough on irrelevant branches that
it'd be a waste of time to fetch them all), you may wish to specify only a certain
refs to be updated. (A single refspec may be passed as a string, or multiple refspecs
may be passed as a list or set of strings.)
categoryGitPoller.
This will then be set in any changes generated by the GitPoller, and can
be used in a Change Filter for triggering particular builders.
projectGitPoller.
This will then be set in any changes generated by the GitPoller,
and can be used in a Change Filter for triggering particular builders.
usetimestampsTrue), or ignore it in favor of the current time (so recently processed commits appear together in the waterfall page)
encoding'utf-8'. This will not be applied to file names since git
will translate non-ascii file names to unreadable escape sequences.
from buildbot.changes.gitpoller import GitPoller
c['change_source'] = GitPoller('git@example.com:foobaz/myrepo.git',
branch='great_new_feature',
workdir='/home/buildbot/gitpoller_workdir')