Wednesday, February 22, 2012

ReviewBoard on Ubuntu 10.04 LTS


Code Review

Code review is considered complimentary to testing and has been shown to be effective at improving software quality. We use the excellent ReviewBoard code review application.

We'll install ReviewBoard with support LDAP. The source code for this package is available here.

Installation

Ensure that you have the fimero package repository configured.

$ sudo apt-get install bbreviewboard

You'll be asked a series of questions e.g. MySQL password or the hostname you'd like to use for your self-signed certificate. The installation will then complete. Once finished, point your browser to https://{reviewboard-server}

LDAP Configuration

Log in as admin.

Click on the Admin button on the upper right.

Click on Settings.

Click on Authentication.

Select LDAP.

Enter your settings.

Note that your cn must contain a givenName and a surname separated by a space. This is an issue with the way Reviewboard generates a user and should be considered a bug.

You can now log in via your LDAP username and credentials.

Note that if you're installing ReviewBoard on a machine that hosts Mindtouch, you'll need to update your /etc/apache2/ports.conf


There is a good example of ReviewBoard work flow with Mercurial available here.

With additional documentation available here.

Mercurial Integration

You'll need to download the source for the Mercurial integration for ReviewBoard.

$ mkdir -p hgdev/com.googlecode
$ cd hgdev/com.googlecode
$ hg clone https://code.google.com/p/mercurial-reviewboard/

Now update your Mercurial $HOME/.hgrc file to include the following:


Workflow

We had to experiment with several approaches before we came up with a usable workflow for Mercurial. It seems that ReviewBoard was designed for pre-commit reviews although with a little tweaking, a usable Mercurial workflow is possible.

We'll assume your username is asmith.

  1. Create a master repository e.g. acme on Bitbucket. This should be under a user that holds the golden copies of your source code. Let's call this user kroboto. Give asmith read access to this repository.
  2. Create a repository on ReviewBoard that points to this golden repository.
  3. Clone this repository locally into $HOME/hgdev/org.bitbucket/kroboto/acme with hg clone https://asmith@bitbucket.org/kroboto/acme. This serves as your baseline.
  4. User asmith then creates a personal acme repo on BitBucket. She then clones the golden acme into $HOME/hgdev/org.bitbucket/asmith/acme. Finally, she edits .hg/hgrc to point to her personal acme repository.
  5. asmith begins working on her code base committing and push as needed until she is ready for a code review.
  6. She first does an hg pull -u on her golden copy. She then pulls her changes from $HOME/org.bitbucket/asmith/acme into $HOME/org.bitbucket/kroboto/acme and performs any necessary merges.
  7. She submits a code review with hg postreview tip. This produces a code review id (e.g. 17). She submit subsequent reviews with hg postreview -l -e 17 tip until her code is accepted.
  8. Her code is then merged with the kroboto repository.

Backup And Restore

To backup ReviewBoard, dump the MySQL database. You can automate this process with one of several options for MySQL.



No comments: