First off, nothing here is new :). Just collated stuff from around the web, integrated svn+bugzilla on a virtual machine. This step by step guide is here ‘cos 15 days from now I wont remember how I managed to get it off the ground :).
What does it mean to integrate a SCM (software configuration management) tool with a bug tracker?
Here’s some of the things that we’d like to see happen
1. When you checkin files, checkin comments are mandatory. Furthermore, checkin comments should refer an open bug assigned to the user bug in the bug tracker . If any of this fails, check in should fail.
2. When you checkin a file, the check in comments should further be checked for minimum length
3. The checkin comments should propagate to the bug tracking software and be recorded as comments against the bug.
4. In addition to the check in comments, the comment in the bug tracking software includes,
Name of the person checking in files
List of files that were checked in
Okay, now to the meat:
Here’s the setup
As you can see, I’m running debian and Subversion 1.1.4
Bugzilla version is 2.16.7
We’ll step through getting each of these up (other than debian linux itself)
In addition to the Subversion and Bugzilla, we need an additional piece of software that sits in between the two and does the magic – this is another open source project called Scmbug. In a nutshell, it hooks into Subversion using pre-commit and post-commit hooks and uses Bugzilla’s perl api’s to manipulate bugs stored in the bug db. I’m using scmbug 0.18-3 which is the version advised on the scmbug homepage on freshmeat.net.
A note on getting a machine to do all the setup – you dont need one :). Here’s how
1. Download the free vmware player from VMWare download .
2. Download Debian Sarge, minimal (netinstall) version.
3. Launch the vmx file. You’ll have linux vm booting inside windoze :).
This is the minimal install of debian – so if you need to install additional software (which you no doubt will), you can pick and choose. In addition, if you have the debian dvd/cd, you could probably coax it to use local resources for getting the .debs.
Sidenote – Using the Aptitude package manager
Debian’s package manager interface Aptitude makes it a breeze to get debian packages up and running. It takes care of dependencies and has a decent interface to it. What follows is a really short tutorial on aptitude.
You’ll need to be root or sudo root to run aptitude. On the bash prompt:
You’ll get aptitude’s main screen
It shows top level packages. You can navigate around with arrow keys and Enter expands a category.
We will use the more powerful search to locate packages and install them. Here are the keys
/ (forward slash) – search.
To go to the next match, press / again.
+ (plus) — select a package for installation. It will be highlighted in green. It will also select any dependencies.
– (minus) – deselect a package. If the package is installed, the package is marked for uninstallation.
g – go – go and do the changes. If dependencies were selected, and intermediate screen shows the packages to be installed/removed. Press g again to download the .debs and commence installation.
q – quit aptitude
F10 – access menu. Once the menu drops down, use the arrows.
Hopefully, that should see you through any installations required. We’ll go to the installations next.
Installing Subversion, Bugzilla and scmbug.
Here’s the big picture below.
- Install Apache2 from aptitude.
- Check your installation of Apache by doing http://<ip> – you should get a It works page :).
- Select subversion and install it.
- Select libapache2-svn package and install.
- Finally, install websvn.
The best place to start will be with subversion. A good tutorial on installing subversion on debian is here.
Also, since we will be accessing SVN using webdav, you can skip steps related to setting up ssh and password less ssh access from clients.
Now test subversion at the end. Install tortoiseSVN on your windows machine and verify that you can import a folder and then check in files.
Also verify websvn by accessing http://<ip>/websvn
Okay, so bugzilla is a little bit more complicated. It isnt a well behaved citizen yet :).
- Install mysql via aptitude. Aptitude will run debconf and ask you to specify username, password etc.
- Now select and install Bugzilla. Choose the ‘automatic’ installation mode. It will ask you for bugzilla administrator user name. Be sure to enter a valid email id – ie, with an @ and the domain part containing atleast one period. I used email@example.com – you can too.
- Verify that Bugzilla works. Point your browser to http://<ip>/cgi-bin/bugzilla/index.cgi. You should get bugzilla’s antsy page.
- If you get here, create a TestProduct – ideally the same name as the name you gave to your subversion repository.
- Create a Bugzilla user – you want this to be similar to the subversion username
- For ex: if the subversion user is iunknown, then create a bugzilla user firstname.lastname@example.org. Later on when we configure the glue between svn and bugzilla, we’ll define a mapping to convert from svn usernames to bugzilla users.
- Create a bug – this is the bug against which we’ll set up bugzilla/svn integration.
Scmbug is the naughtiest of them all and takes the longest to get off the ground. Also, scmbug should be installed locally on the machine that hosts bugzilla
- Download .debs from scmbug homepage
- since these are .debs directly, we’ll use dpkg to install. Its typically
- dpkg –install <.deb filename>
- The order to install is
- Note that just installing the packages does not configure them to run right. Most probably, the scmbug-server daemon startup would have failed during startup.
We’ll go about setting that right next.
- Open /etc/scmbug/daemon.conf in an editor as root.
- Entries to edit are:
- The next part is mapping subversion usernames to bugzilla usernames. This can be done in the mapping section. Search for mapping_regexes
‘(\w+)$’ => ‘$email@example.com’
maps a username like raghu to firstname.lastname@example.org
That’s about all the configuration that you need. Try starting the scmbug_server
Some ickiness that I faced:
Scmbug server fails to start with a warning for uninitialized variable in Daemon.pm
In my case, this error came up while checking if the LDAP should be used for mapping. Locate daemon.pm ususally in /usr/share/scmbug/libusr/share/scmbug/lib/Scmbug/Daemon/Daemon.pm
and comment out the code for LDAP integration.
2. Unable to see changes to globals.pl
doesnt really kill the server. Use a kill -9 to kill the scmbug server and restart.
The final piece in the jigsaw to be configured – the subversion hooks so that subversion queries against the scmbug_server. Run
scmbug_install_glue –scm=Subversion –product=TestProduct \
–repository=/tmp/testrepository –bug=770 –binary-paths=/bin,/usr/bin \
This assumes that bugzilla product name is TestProduct and the scmbug server is running locally on the loopback address. Furthermore , Subversion repo is located at /tmp/testrepository. if you do want to change anything, you can edit the Glue.conf file at <repopath>/hooks/etc/scmbug/glue.conf.
If the hook installation goes through fine, you can go ahead and give it a spin. Log a bug and then commit some files against it. Your comment should be of the form bug 1: [ie following the bug pattern defined in the glue.conf]
You can customize glue.conf to enable/disable policies on a repository level .