So, I set up cijoe for our company yesterday. It wasn’t too bad to set up; the instructions are pretty clear for how it works. Now that it’s running, we can see who broke the build, and I set up a post-build hook to notify our office chat room who broke it and link to the commit in our source browser. That’s pretty cool; but it’s still possible to take down the site if you commit something bad and deploy it before the build finishes.

Well, not anymore.

We use a shell script to wrap our capistrano deployment system, so I just added the following to the beginning of it:

RES=$(curl --write-out %{http_code} --silent --output /dev/null http://our.cijoe.server/ping)
if [ $RES -ne 200 ]; then
  echo "Can't deploy right now, check build status at http://our.cijoe.server"
  exit
fi

Now you can’t deploy until our server is done building, and you can’t deploy at all until the build passes. Better keep those tests up to date, eh?