When your Continuous Integration server starts breaking sporadiablly you basically have to drop everything you're doing and figure out why. Until the time that it's fixed you'll not be able to trust whether your code base is running as expected.
On Friday our CircleCI builds started failing with.
An error occurred in an after hook Errno::EPIPE: Broken pipe occurred at /home/ubuntu/app/vendor/bundle/ruby/2.2.0/gems/capybara-webkit-1.3.1/lib/capybara/webkit/connection.rb:30:in `write' F
Now usually when we get a failure it's because we've changed some code and inadvertently broken another part of the code. This time the failure was happening on every branch, including those that had failed before.
Being that it wasn't an issue with our code I reached out to Circle's excellent support team. Unfortunately this time aside from suggesting I SSH into the system there was no real advice.
I left work Friday afternoon knowing that a broken CI would ruin the next week of work, and really not looking forward to the drudgery of trying to fix a system error on a service we pay for.
Alright, no big deal we'll just install PhantomJS 2 on our Circle server.
Binary packages for Linux are still being prepared. There are still issues to be solved until a static build is available (see ariya/phantomjs #12948 for more details).
In the mean time, it is recommended to build the Linux version from source.
Okay, turns out that is a big deal. Building from source would take 30 minutes, each time we ran our tests. Obviously this would not be a suitable solution to the problem.
Returning to Capybara-Webkit
We wouldn't be able to run away from our problems, we'd have to face them head on and figure out why Capybara-Webkit started failing all of a sudden.
Salvation did come in the form of CircleCI support reaching out an linking us to thoughtbot/capybara-webkit #540, which had a suggestion to wrap the spec run in the xvfb run command.
This is described in the thoughtbot/capybara-webkit README, something we really should have done from the beginning but hadn't seemed to need to.
test: override: - xvfb-run -a bundle exec rspec: parallel: true files: - spec/**/*_spec.rb - lib/inter_exchange/spec/**/*_spec.rb
We're Hiring Software Engineers
Join InterExchange and help us improve the future of cultural exchange.Learn More