Daniel Doubrovkine bio photo

Daniel Doubrovkine

aka dB., CTO at artsy.net, fun at playplay.io, NYC

Email Twitter LinkedIn Github

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
  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.

echo "
Visit http://ci.example.com:9000/ for details

Author:  $AUTHOR

" | 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 .