Saturday, December 3, 2011

Programming: Putting all of the Pieces together (Part 4)

While teaching the developers the proper process of coding and testing and committing will make them better developers, I need something to help me monitor the process.  So far all I have is labor intensive reviewing individual commits and running the tests by hand.  Pulling back in things learned from cornell while working on VIVO I can automate my tests with Jenkins.

Jenkins is amazing, I've spent part of the previous week putting together a POC installation on a Virtual Machine and the tests that I can run.  There are plugins for Selenium and Grails and code review like codenarq and code coverage.  With this we can automate tests to be performed before code is merged with develop.  If our developers are following the appropriate steps, their code will pass with flying colors.  If they are not following the appropriate steps, I save time and effort by having a robot (jenkins) remind them to test their code and that the code they are trying to submit fails.

How do I put this into our typical development process?  We're using in addition to Git, Git-Flow.  Basically it formalizes our branching structure so that between projects we are all following the same methods for defining the production branch (master) the development branch (develop) the working branches (/feature) and branches for hot fixes, version tags, etc.  Inserting jenkins into my development process isn't as easy as targeting a branch.  If I select master, I'm not testing often enough as its only receives release candidates from develop.  I could select develop, however, I want to insert it before the code comes into the develop.  I want to tigger it when my developer in his branch calls
git flow feature finish featureName

Also I don't want to only rely upon automated review.  What if my developer didn't add the appropriate tests for his or her new feature.  What if the poor code is syntactically perfect, but lacks good design decisions.  The code review tools will catch a lot of these errors, but not all of them.  Re-enter the original concept of code reviews.  When your peers see your code, you code cleaner, smarter, more efficiently.  Enter Gerrit, a code review system that automates the process of reviewing code.  It sets up review tickets, and can be integrated with jenkins to allow jenkins to weight in a pass/fail based on the scripted tests.  Reviewers can be setup for each developer and I can get emails when there is code for me to review.  Upon successful review the code can be automatically merged back into our main development trunk.

So this is the task this week; put it all together.  I have the proper pieces falling into place, now I need to make them match up.  How do I interrupt the git-flow process to insert Gerrit?  How do I make Gerrit preform the rest of the merge with develop if the reviewers and Jenkins approve?  

No comments: