Local Builds in CircleCI 2.0



Documentation for this topic is now available on our documentation site: https://circleci.com/docs/2.0/local-jobs/

SSH debugging?
Managing Parallelism with the 2.0 Tests CLI

Just in-case anyone is aliasing grep with colour (as I was), can you please run add –color=never to the circleci-builder-beta shell script


Hello! The highlighted “sample golang project” above isn’t a link. What’s the full link please?


I’m having trouble using the local build tool.

  1. Is it open source somewhere or are there more docs for it that I can peek under the hood?

  2. The exact problem I’m having is that I’m having difficulty finding my code (i.e. the code from the directory where I’m running the local build tool) inside the test container

  • I downloaded the tool locally
  • I forked/cloned the golang example (and tried this for cci-demo-react too) https://github.com/nathanleiby/cci-demo-go
  • I run circleci-builder build
    • for the Go example, I get errors that suggest it cant find my workdir: Error: path '/go/src/github.com/circleci/cci-demo-go' either does not exist or is not a directory. Did you run a checkout step or mkdir? If I remove the workdir settings from the circle.yml, the build progresses a bit further, but I’m so far unable to find my code inside the build container
    • for the react example, I get the same kind of workdir errors locally (Error: path '/home/ubuntu/demo-react-working' either does not exist or is not a directory. Did you run a checkout step or mkdir?). Removing the workdir, I start to get other errors like npm ERR! enoent ENOENT: no such file or directory, open '/package.json'

tl;dr — when you’re running a build locally, where does it mount your local code in the test container?


Made a bit of progress here. Realized I need to explicitly mount my local code via

circleci-builder -v $(pwd):$WORKDIR

where WORKDIR is the value that’s set in the circle.yml.


Shoot, it is a real link but we’re hosting in a private repo on GitHub right now. We’ll try to get those sample projects out in the open so you can take a look.

For now, though, I’ll remove it because wow, that is confusing.


Ah, makes sense. Thanks!


When I run any command after installing the CLI, it just hangs indefinitely with:

Receiving latest version of picard…


Would it be possible to check permissions on the circeci-binary? I know I had to play with mine a bit to get it work properly.


That did it, thanks!


UPDATE: it was due to invalid yml. Error message was not so clear. Fixed it.

Don’t know exactly when it started but I think it was after a circleci-builder update. Everytime I try to build locally I get this:

====>> 0. Spin up Environment
Build-agent version 0.0.1915-bea1dcf (2016-12-26T15:42:09+0000)
Error: Error finding Picard configuration. Double check circle.yml presence.

Step failed
Task failed


@travis1 Try changing /home/ubuntu/frontend to /home/circleci/frontend


It looks like checkout step is skipped in local builds, so you have to mount your fs

circleci-builder build -v $(pwd):/home/ubuntu/frontend

Source: Local Builds in CircleCI 2.0


sorry should be
circleci-builder build -v $(pwd):/home/ubuntu/frontend


Does local-builds work with ‘executorType: machine’?


No, but you’re certainly welcome to try it.


@rohara Didn’t get your reply. How can someone try what isn’t working yet?


You’re certainly welcome to try it to see what happens :slight_smile:


I’m having some issues with local builds and networked services using pod images.

version: 2
executorType: docker
  - image: opstarts/circleci
      - DISPLAY=:99
      - CHROME_BIN=/usr/bin/google-chrome
  - image: mongo:2.6.9
    cmd: ["mongod"]

Then when I try to start my application:

MongoError: failed to connect to server [] on first connect


Do you get the same error without specifying the cmd on the mongo container?