Next: , Previous: Mail-parsing ChangeSources, Up: Change Sources


4.6.4 PBChangeSource

The last kind of ChangeSource actually listens on a TCP port for clients to connect and push change notices into the Buildmaster. This is used by the built-in buildbot sendchange notification tool, as well as the VC-specific contrib/svn_buildbot.py, contrib/arch_buildbot.py, contrib/hg_buildbot.py tools, and the buildbot.changes.hgbuildbot hook. These tools are run by the repository (in a commit hook script), and connect to the buildmaster directly each time a file is comitted. This is also useful for creating new kinds of change sources that work on a push model instead of some kind of subscription scheme, for example a script which is run out of an email .forward file.

This ChangeSource always runs on the same TCP port as the slaves. It shares the same protocol, and in fact shares the same space of "usernames", so you cannot configure a PBChangeSource with the same name as a slave.

If you have a publicly accessible slave port, and are using PBChangeSource, you must establish a secure username and password for the change source. If your sendchange credentials are known (e.g., the defaults), then your buildmaster is susceptible to injection of arbitrary changes, which (depending on the build factories) could lead to arbitrary code execution on buildslaves.

Buildbot does not currently allow PBChangeSource to run on a different port than the slave port. That will be fixed in bug #1708.

The PBChangeSource is created with the following arguments.

port
which port to listen on. If None (which is the default), it shares the port used for buildslave connections.
user and passwd
The user/passwd account information that the client program must use to connect. Defaults to change and changepw. Do not use these defaults on a publicly exposed port!
prefix
The prefix to be found and stripped from filenames delivered over the connection, defaulting to None. Any filenames which do not start with this prefix will be removed. If all the filenames in a given Change are removed, the that whole Change will be dropped. This string should probably end with a directory separator.

This is useful for changes coming from version control systems that represent branches as parent directories within the repository (like SVN and Perforce). Use a prefix of 'trunk/' or 'project/branches/foobranch/' to only follow one branch and to get correct tree-relative filenames. Without a prefix, the PBChangeSource will probably deliver Changes with filenames like trunk/foo.c instead of just foo.c. Of course this also depends upon the tool sending the Changes in (like buildbot sendchange) and what filenames it is delivering: that tool may be filtering and stripping prefixes at the sending end.

The following hooks are useful for sending changes to a PBChangeSource: