SvnBot IRC Notification Robot

The SvnBot is a simple single purpose IRC robot that monitors one or more SVN repositories. When changes are committed to a source repository the robot makes an announcement in an IRC channel. The purpose of the tool is to allow a team of developers to keep up to date on changes that other team members are making. SvnBot does not rely on commit-hooks as many other bots do, instead it acts as a deamon periodicaly polling the repository to see if any changes have occurred. This allows the robot to run independently of the repository.

Downloads

News

How to use

From the binary distribution simply run the Java jar file with the “-c” parameter passing the path to a configuration file. An example configuration file is provided with the with both the binary and source distributions.

java –jar svnbot-1.1-jar-with-dependencies.jar –c path/to/config

Since many will want to deploy SvnBot on a server and forget about it, you’ll probably want to run SvnBot within a nohup operator. The nohup command will allow the Java process to continue running even after you’re shell has disconnected (i.e. ignore the “hang up” signal). Here’s an example as for quick reference:

nohup java -jar svnbot-1.1-jar-with-dependencies.jar -c path/to/config
      < /dev/null >> /dev/null 2>> /dev/null &

Configuration

The configuration file format is a mix of XML and standard Java properties similar to Apache’s httpd configuration format. There are three types of configuration sections: <irc>, <log4j>, and multiple <repository> tags.

<irc> This section configures the IRC server and channel where to announce changes.

<log4j> This section configures how logging messages from SvnBot will be handled. This uses standard log4j syntax.

<repository> This section configures an SVN repository to monitor: specify the url, authentication, polling frequency, etc. The SVN bot is capable of monitoring multiple repositories, just add multiple definitions for each repository.

Below is the example configuration file. Note only the IRC’s server, channel, and repository’s url are required parameters. All other parameters are optional, either for special circumstances or have reasonable defaults.

# SvnBot Configuration
#
# java -jar svnbot-1.1-jar-with-dependencies.jar -c path/to/this/config
#
# Note you must use XML escaping such as: &amp; &lt; &gt; &quot &apos

<irc>
    # The hostname, port, and channel of the IRC server
    server = irc.freenode.net
    channel = #svnbot
    #port = 6667

    # The nickname to use when communicating on IRC
    #nick = SvnBot

    # Authentication credentials for the IRC Server
    #username = your-irc-username
    #password = your-irc-password

    # The notice message is sent to everyone in the channel when the bot
    # first starts, letting others know that the bot has joined the 
    # channel.
    #notice = I am an SVN Bot. I report commits to the ??? repository.
</irc>

# Optional logging configuration.
<log4j>
    # This section uses Log4j configuration syntax. The example below
    # will log messages to /var/log/svnbot.log. However, if no log4j
    # section exists then all messages INFO and higher will be sent to
    # stdout.
    #
    # See http://logging.apache.org/log4j/1.2/manual.html for more
    # information

    # Log everything INFO and greater to a File
    #log4j.rootLogger = INFO, FILE

    # Define the FILE's location
    #log4j.appender.FILE = org.apache.log4j.FileAppender
    #log4j.appender.FILE.File = /var/log/svnbot.log

    # Define the FILE's layout
    #log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
    #log4j.appender.FILE.layout.ConversionPattern = \
              %d{ISO8601} [%t] %-5p %c %x - %m%n
</log4j>

# Repeatable repository configuration.
<repository type="svn">
    # The URL of your SVN repository
    url = https://yourepository/

    # Authentication credentials for the SVN Server
    #username = your-svn-username
    #password = your-svn-password

    # Targeted paths restrict the SvnBot's focus to only monitor changes
    # within the specified paths. There can be multiple paths separated
    # by a comma and each path must be anchored to the root of the
    # repository. Only commits to the repository that affects a file under
    # one of these paths will be reported in IRC.
    #targetPaths = project1/ project2/subproject, ...

    # The amount of time between polling the repository. Periodically
    # SvnBot will check the repository to see if there have been any
    # new commits. The default interval is 30 seconds. However, if
    # your repository is under heavy load you should use a higher
    # interval such as 60 or 150 seconds.
    #pollinterval = 30

    # Nicknames are used to translate the repository's usernames into
    # something more friendly. The username on the left side will be
    # replaced with the nickname from the right side when the commit
    # is announced in IRC.
    <nicknames>
        william = Bill
        charles = Chuck
        biglong@emailaddress.com = Short &amp; Sweet
    </nicknames>
</repository>

# Repeat the repository section for each repository.
<repository>
    ...
</repository>

How to compile

Prerequisites:

This project uses Apache Maven as its build and distribution management system. To compile the project use the following maven command:

mvn package

Two binary files will be compiled into the “/target” directory. You will find “svnbot-<version>-jar-with-dependencies.jar” which is a runnable jar file. The other jar file included is “svnbot-<version>.jar” which just includes the svnbot class files without other dependencies for SVN or logging. This jar file is suitable for inclusion in other projects.

This project uses the PircBot library to handle communication with the IRC Server. Another important dependency is the pure Java implementation of the SVN protocol with the SvnKit library.