April 12, 2015

The pull request builder - Get your work tested before it gets merged

At Yproximité, even if we are a small team, we validate features before and after it gets merged. In order to achieve that, you’ll need an awesome process called “The pull request builder”.

Basically, the pull request builder makes your pull request accessible on a production isolated environement.

Why build a pull request ?

  • I’m your customer, I want to make sure that you got me right when I wrote those “specs”
  • I’m the QA (Quality people), I want to make sure that it’s not already broken
  • I’m the lead developper, I want to try your feature while I’m code reviewing it
  • Fill any other cases there…

What do you need ?

  • Github
  • Ansible
  • Any project, in any language (PHP/Symfony2 for us)
  • Tower, an Ansible GUI, though it’s not mandatory
  • Tower-cli, a tool to comunicate with the Tower REST API
  • A pre-production server(s) to deploy your PR on

Pull request builder by Yproximite

So you can get started more easily, I’ve open sourced some basic code (nothing fancy there though).

After setuping the hook on Github, you’ll need some script that will treat the event (pull request opened, update, or closed) :

Then, take a look at :

And from this point, Ansible plays the deploy playbook. If you need to catchup with Ansible and if you’re French, you can take a look at my Ansible presentation.

Within 20 minutes (or 5 minutes if it’s a pull request update), the team will recieve a notification in order to access the dedicated environment

We can push this even further and play with docker containers and deploy the pull request on a temporary VM such as RunAbove or Amazon EC2.