Daniel Doubrovkine bio photo

Daniel Doubrovkine

aka dB., @awscloud, former CTO @artsy, +@vestris, NYC

Email Twitter LinkedIn Github Strava
Creative Commons License

A nice way of telling CIJoe (or any other CI service) what to do is to commit git configuration under, for example, git-config.

Here’s what a typical git-config/config looks like. It’s the same as your usual .git/config.

We’re going to have a remote [origin] and a [cijoe] section that tells CIJoe what to do.

[remote "origin"]
  fetch = +refs/heads/\*:refs/remotes/origin/\*
  url = git@github.com:name/project.git
[branch "master"]
  remote = origin
  merge = refs/heads/master
[cijoe]
  runner = ((bundle check || bundle install) && bundle exec spec spec )
  buildqueue = true

We can also have two scripts, git-config/build-worked and git-config/build-failed. Here’s the latter.

#!/bin/sh
echo "
Visit https://ci.example.com:9000/ for details

Author:  $AUTHOR
Message:
$MESSAGE

$OUTPUT
" | mail -s "[example] BUILD FAILED $SHA" --to dev@example.com

How do we hook this up? CIJoe tells us to place all this stuff into .git/hooks.

We can just trick it with some symbolic links on the CI server.

cd .git
rm config
ln -s ../git-config/config .
cd hooks
ln -s ../../git-config/build-failed .
ln -s ../../git-config/build-worked .

Easy.