keskiviikko 28. lokakuuta 2009

Deployment system

I strongly believe that tool supported deployment system is necessary for successful software development, especially when using agile or lean methodologies. In both methodologies there's strong emphasis to finish one feature completely before moving to another. Good deployment system makes it easier to be sure that feature is actually finished.

The purpose of deployment system is to make sure that every feature is tested, reviewed and accepted by customer. To accomplish this, deployment system should have support for automated testing, code reviewing and issue management. I don't know any single software which would accomplish all of these, so current solution I use consists of multiple different programs.
In ideal development flow when feature is "code ready", it will be pushed to Git repository and Hudson will pull the change and does automated testing. Same time code is reviewed with Gerrit. After these two steps are completed successfully, feature is deployed automatically by Hudson to test server and marked ready in Jira. Then customer checks and accepts the feature effectively ending the development of that particular feature.

Installation of Gerrit

I had a lot of minor issues when installing Gerrit. Fortunately I found pretty good installation help from I also used as guide.

Unfortunately, there wasn't nothing much about using http-basic authentication as a login method when using Jetty, so here's some tips for that. These were done with Jetty 6.8.

First, follow the basic instructions. Then uncompress gerrit.war to Jettys /webapps, make sure that it goes gerrit -directory.

Add following to WEB-INF/web.xml under gerrit -directory, I added these to the top of the file.

    <web-resource-name>A Protected Page</web-resource-name>


Add following lines into gerrit.xml in Jetty's contexts -directory:

<get name="securityHandler">
  <set name="userRealm">

    <new class="">
      <set name="name">GerritRealm</set>
      <set name="config"><systemproperty default="." name="jetty.home">/etc/</systemproperty></set>

Finally, create into Jetty's etc/ and check etc/ for help. Passwords can be created by using the following command:

java -cp lib/jetty-xxx.jar:lib/jetty-util-xxx.jar

tiistai 27. lokakuuta 2009

Integrating Gerrit and Hudson

Some ideas about integrating Gerrit, Hudson and Git we've figured out at work.

Gerrit ( is a code review tool used by the Android project. It has been developed for using with Git ( source control management system. Hudson ( is a continuous integration server. How these two can be integrated?

Basic idea in integration of Gerrit and Hudson is to think Hudson as a reviewer in Gerrit. When using Gerrit, developer uploads his/hers changed to Gerrit's magic branches. These changesets can then be pulled from Gerrit, and this is what Hudson does. It will pull every changeset from Gerrit and run automated tests against them. If tests are successful, Hudson uses Gerrit's command line tools to approve the changeset. This can be done as a final build step in Hudson. After this, it is up to human reviewers to make final decision about approval of the changeset.

After changeset is approved and merged to main repository, Hudson will pull the changeset and performs deployment to test environment.