You are here
Home > LinuxAdmin >

How To Automate Code Review With Reviewboard

This post is simple how-to guide on Automate Code Review And Code Quality With Reviewboard. These days for software code review, code quality and code security lot of online tools are available like BitBucket, Amazon CodeGuru, GitHub, Gitlab but reviewboard is winner. Will list out GitHub and Gitlab major features and move on to Reviewboard. In embedded product development it is important to setup right tools and right process, Earlier, we have seen setting up ceedling test driven product development (TDD) process for embedded systems product development.

GitHub is one of the popular source code management tool. It is web based version control system with easy UI. One of the widely used tool in collaborative software development. With Pull Request or Merge Request you can setup your code review process. You can add screenshots and assign reviewers, get the review done. You can view the history of review at any time.

github review process

Gitlab being open source has lot of good features that GitHub and Azure DevOps are missing, for example better UI and easy CI/CD pipeline setup. Though GitHub and Azure are backed up by Microsoft, its way to go. Gitlab has integrated code review process and once setup properly you can do merge requests, code reviews, branching.

Gitlab review process

I am yet to explore GitHub and CI/CD integration with cloud providers, but for now definitely Gitlab is winner when it comes to smooth integration.

Lets get starred with Review Board as their website mentions it really takes the pain out of code review. It is one of the widely used open source software tool for your code reviews. Using tool like Review Board save lot of time in review. This post describes review board installation steps.

Step 1 – Install MySQL and Apache

Assuming this is fresh Linux system and MySQL Apache is not installed yet follow below steps.

$sudo apt-get install mysql-server

$sudo apt-get install apache2 libapache2-mod-wsgi

Create empty database for review board

Use following Reviewboard mysql commands

mysql> CREATE DATABASE reviewboard CHARACTER SET utf8;

Query OK, 1 row affected (0.00 sec)

mysql> CREATE USER ‘$USER’@’localhost’ IDENTIFIED BY ‘Password’

mysql> CREATE USER ‘$USER’@’localhost’ IDENTIFIED BY ‘Password’;

Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON reviewboard.* to ‘$USER’@’localhost’;

Query OK, 0 rows affected (0.00 sec)

Step 2 – Install Dependencies

$curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

$python get-pip.py

$ pip install -U pip setuptool
$ apt-get install build-essential python-dev libffi-dev libssl-dev patch
$sudo apt-get install python-mysqldb
$sudo apt-get install memcached
$sudo apt-get install python-memcache

Step 3 – Install Review Board

$sudo apt-get install patch 
$sudo apt-get install subversion
$sudo apt-get install python-svn
$sudo apt-get install python-setuptools
$sudo easy_install reviewboard

$sudo rb-site install /var/www/reviews.com

chown -R www-data /var/www/reviews.com/htdocs/media/uploaded 
chown -R www-data /var/www/reviews.com/htdocs/media/ext
chown -R www-data /var/www/reviews.com/htdocs/static/ext
chown -R www-data /var/www/reviews.com/data

$cd /etc/apache2/sites-available
$cd /etc/apache2/sites-available

$cp /var/www/reviews.com/conf/ reviews.com.conf

$cd ../sites-enabled

$ln -s ../sites-available/reviews

Start review board
sudo a2dissite default
sudo a2ensite reviews.com.conf
sudo /etc/init.d/apache2 restart

Accessing url:=== http://192.168.206.24/reviews.

Troubleshooting 

On fresh system along with the solution for Bad Request (400) message. Yes, On fresh Ubuntu system once installation is complete this Review board shows up this error. Lets start with installation steps.

Bad Request (400) message.

if you are getting following error

[Mon Mar 25 17:48:45.230130 2019] [mpm_event:notice] [pid 20381:tid 139766387678144] AH00491: caught SIGTERM, shutting down

[Mon Mar 25 17:48:45.313877 2019] [mpm_event:notice] [pid 20717:tid 139964285795264] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/2.7 configured — resuming normal operation

This is a very important step; Open ‘settings_local.py’ and make following change

$sudo vi /var/www/reviewboard/conf/settings_local.py

ALLOWED_HOSTS = ['reviewboard'] 

To

ALLOWED_HOSTS = ['*']

Thats it your reviewboard ver. 3.0.14 is up and running.

How to Automate Code Review And Code Quality With Reviewboard

With latest Reviewboard ver. 4, it is possible to integrate with most of the services like aws codecommit, bitbucket, Jenkins and many more. Jetkins CI is popular service for continuous integration, that perform automatic builds, and deploy to servers. It will be great if we can integrate reviewboard with redmine.

Happy reviewing!!! Hope you have enjoyed reading with how to Automate Code Review And Code Quality With Reviewboard.

Leave a Reply

Top
%d bloggers like this: