CircleCI CLI running locally on Windows


#1

Long story short - it is possible.

This worked for me on Windows 10 Home:

  1. First you need Docker running. Docker for Windows is not supported on Windows Home (because Home edition doesn’t include Hyper-V), so I installed VirtualBox and Docker Toolbox. If docker run hello-world works, you’re all set, otherwise refer to the Docker documentation.
  2. Copy the URL from the installation instructions and download the file: https://circleci.com/docs/2.0/local-jobs/#installation
  3. The file is a Bash script, so you need a Bash interpreter. I’m using Git Bash, which gets installed when you install Git for Windows.
  4. Git Bash does some magic with paths, eg. it translates /c/User/x to C:\User\x. You need to supress this behavior when running the CircleCI script.
    I defined an alias in my .bashrc:
    alias circleci='MSYS_NO_PATHCONV=1 /c/Users/x/bin/circleci'
  5. Mount the drive with your project:
  • Open VirtualBox, click on the “default” instance, click “settings”, “shared folder” and add C:\ as C_DRIVE.
  • After starting the docker-machine, mount the shared folder to the host filesystem: docker-machine ssh default "sudo mkdir -p //c && sudo mount -t vboxsf C_DRIVE //c"'
  • The point of this step is to make the absolute path to the project the same in the context of Git Bash as well as in the context of the Docker host.
  1. If your build needs to create symlinks (eg. npm install), you need to:
  • Run the docker-machine start as an administrator.
  • Setup the VBox instance to support symlinks: VBoxManage.exe setextradata default VBoxInternal2/SharedFoldersEnableSymlinksCreate/C_DRIVE 1

Hope this helps someone.


#2

Thanks so much for taking the time to document this :slight_smile:


#3

Thank you @VaclavSir for sharing this with rest of CircleCI community :slight_smile:

This is helpful.


#4