We recently had an issue where our CI build broke over the weekend.
We used git bisect to figure out where the problem occurred.
We wrote a cucumber feature (feature/path/to/is_it_fixed.feature) that worked on Friday and fails today.
We start by setting up git bisect:
git bisect GOOD BAD
Where GOOD is the git SHA from last Friday and BAD is this morning’s SHA.
Then we created a shell script that will setup the environment and run the feature:
#!/bin/bash set -e git checkout . rake db:drop rake db:create rake db:migrate rake db:test:prepare cucumber feature/path/to/is_it_fixed.feature:20 -r features
We then run this command with the following:
git bisect run /path/to/shell/script.sh
This will then automatically keep running until it finds the SHA that breaks that feature. At the end of the run, it helpfully prints “SHA __ caused the issue”.