As if CircleCI hasn’t caused enough stress and inconvenience over the past few weeks, today I pushed a small change to some code only for the build to fail entirely, for a novel reason:

Directory (/home/circleci/project) you are trying to checkout to is not empty and not a git repository

I hadn’t changed anything since yesterday, but now git couldn’t check out the code because the directory wasn’t empty any more.

I reran the job with SSH access, and took a look:

$ ls -lah /home/circleci/project/
total 320K
drwxrwxr-x 1 circleci circleci   34 Jan 11 16:46 .
drwxr-xr-x 1 circleci circleci   60 Jan 11 16:46 ..
-rw-r--r-- 1 circleci circleci 319K Jan  4 02:17 LICENSE.chromedriver

Somebody had decided to dump a load of legalese in the working directory as part of the chromedriver installation step. I don’t know whether that’s someone at Google, or someone at CircleCI. I don’t know if it’s actual lawyers or just programmers engaging in a licence file cargo cult. I do know that finding a third of a megabyte of logorrhoea blocking my way to getting my work done hasn’t in any way encouraged me to read it.

The solution is straightforward. I added a step to clean up the mess immediately before the checkout directive in the project’s .circleci/config.yml file:

steps:
  ...
  - browser-tools/install-chrome
  - browser-tools/install-chromedriver
  - run:
      name: Remove legal junk
      command: rm -f LICENSE.chromedriver
  - checkout

And now I have one less problem. But again, thanks for nothing to all the legal minds involved.