Is the circle CLI tool supported on Circle CI itself?


#1

I’ve got a project which provides a CircleCI template for other projects. What I’d like to do is actually test our templates against live code in CircleCI. In other words, clone a known-good repository, install the updated templates, and then run the CircleCI tests inside of the existing container.

I think this should be possible using the circle CLI along with the setup_remote_docker key.

However, when I run a job, circleci config validate complains that there is no config.yml file available. So, I dropped into the job with SSH, and ran the actual command that circleci is building:

docker run -it --rm -e DOCKER_API_VERSION=1.23 -v /var/run/docker.sock:/var/run/docker.sock -v /home/circleci/project:/home/circleci/project -v /home/circleci/.circleci/:/root/.circleci --workdir /home/circleci/project circleci/picard@sha256:04772b49e171fb7e6a6c535f713f8ce1eb27921b95cd4fbfbfae047b4eaf842e circleci config validate

Note the volume mount pulling the project into the nested container. Looks good! Except, when I run ls inside of the container, the project directory is completely empty:

circleci@9165c9b01f4e:~/project$ docker run -it --rm -e DOCKER_API_VERSION=1.23 -v /var/run/docker.sock:/var/run/docker.sock -v /home/circleci/project:/home/circleci/project -v /home/circleci/.circleci/:/root/.circleci --workdir /home/circleci/project circleci/picard@sha256:04772b49e171fb7e6a6c535f713f8ce1eb27921b95cd4fbfbfae047b4eaf842e ls -la
total 8
drwxr-xr-x    2 root     root          4096 Nov  8 19:01 .
drwxr-xr-x    3 root     root          4096 Nov  8 19:15 ..

The files are all present in the root container:

circleci@9165c9b01f4e:~/project$ pwd
/home/circleci/project
circleci@9165c9b01f4e:~/project$ ls -la
total 84
drwxr-xr-x 6 circleci circleci  4096 Nov  8 19:01 .
drwxr-xr-x 5 circleci circleci  4096 Nov  8 19:01 ..
drwxr-xr-x 2 circleci circleci  4096 Nov  8 19:01 .circleci
drwxr-xr-x 8 circleci circleci  4096 Nov  8 19:01 .git
-rw-r--r-- 1 circleci circleci  1651 Nov  8 19:01 Dockerfile
-rw-r--r-- 1 circleci circleci 35147 Nov  8 19:01 LICENSE.txt
-rw-r--r-- 1 circleci circleci  5213 Nov  8 19:01 README.md
drwxr-xr-x 2 circleci circleci  4096 Nov  8 19:01 hooks
-rwxr-xr-x 1 circleci circleci   518 Nov  8 19:01 install-composer.sh
-rwxr-xr-x 1 circleci circleci  2729 Nov  8 19:01 setup.sh
drwxr-xr-x 4 circleci circleci  4096 Nov  8 19:01 templates
-rwxr-xr-x 1 circleci circleci   640 Nov  8 19:01 test.sh

Any ideas?


#2
circleci config -c circleci-config.yml validate

Where circleci-config.yml is the config in question in your pwd.


#3

The problem is that none of the repository files are available to the circleci command inside the nested Docker container, even though it’s being passed to the Docker daemon -v flag correctly.


#4

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.