circleci-cli: local execute - fails to read config file
Context
I’m working on a CircleCI config generator (amongst other things) so I want to test that:
- the generated config is valid (
circleci config validate) - the generated tests pass (
circleci local execute --job myjob)
From within CircleCI, so essentially I’m running those CircleCI commands in CircleCI. Very meta but it sounds like it should work. First command (config validation) works fine.
Problem
I get the following error when running circleci local execute --job myjob (within a CircleCI job):
$ circleci local execute --job myjob
Docker image digest: sha256:0ae15d9b8329446dd5d241b1d654774871caa89c1cc47d513063c23037aae917
Error: failed to start event processor: failed to compute task config: failed to read config file: open circle.yml: no such file or directory
It’s confusing because I’m using .circleci/config.yml and not using circle.yml.
The same command runs fine locally.
Running version 0.1.4211+14dfd68
What I tried
- Using the
--configargument ❌ - Moving the generated code outside of the generator repo (to avoid git conflicts or even multiple circle ci config files in parent directories) ❌
- Running
chmod 777 .circleci/config.yml❌
Here’s the smallest generator config file I’ve been able to reproduce teh bug with: https://gist.github.com/n6g7/f11008ee351b3dfd9c56f6c23b5ce7d6, I don’t think the generated config file matters but can share it too if necessary.
Any idea where this could be coming from?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 8
- Comments: 18 (6 by maintainers)
@jgonzalezd
experiencing this issue after installing
circleciwith snap as by instructions and trying to run the hello world example.this could be connected with limitations of snap packages to the
$HOMEdirectory, as it is trying to write/read a files save in the root/tmp/whilecirclecican only run in/usr/home/<user-name>SOLUTION TO FIX THE ISSUE
Remove snap packages (docker and snap)
I used the command from the quick installation instructions without sudo and saved the
binfile in my/home/<username>/Downloadsfolderthen I moved the binary
sudo mv /home/fabrizio/circleci /usr/local/bin,/usr/local/binis in my path so I have access within the$HOMEas normal user.Installing docker as by askubuntu instructions (options 2), adding myself to the docker group and now the command works without problems
circleciwas failing becausesnapinstallation can not write or read/tmpIt was fun playing with Ubuntu the entire day…I’m running into the same issue, it doesn’t even work for the demo repo.
@fabriziobertoglio1987 I can’t run the quick installation command without sudo. When I try to run it I get this error:
Trying to get CircleCI working locally
circleci local execute. This works (and is simpler IMO 👍 )gittag (so CircleCI CLI can usegitcommand within the container)/usr/bin/docker run --rm --privileged --tty --interactive --volume /tmp:/tmp:rw --volume /var/run/docker.sock:/var/run/docker.sock:ro --user root --name circleci docker:git /bin/sh--privileged,volumefordocker.sockand arwmount of local/tmp.--user=rootbash,curlfollowed by CircleCI CLI./sbin/apk update/sbin/apk add bash curl/usr/bin/curl -fLSs https://circle.ci/cli | /bin/bashfoo_ciproject (like this).circleci/config.yml(like this)Works for below errors-
circleci Error: failed to start event processor: failed to compute task config: failed to read config file:(👍 Step 1)cp: cannot stat '/tmp/_circleci_local_build_repo/.git': No such file or directory(👍 Try step 3 on a hello world project)@anishkny A workaround for running a CircleCI config generated inside of a CircleCI job is to commit that config and push it to Github/Bitbucket to trigger a new build. This is far from ideal, so we are considering ways to execute a new config without a commit and push.
I am facing a similar issue trying to run a generated config yml using
circleci local executein CircleCI.In my test, I generate a
processed.yml(running on CircleCI) and then execute:But I get an error:
Is there a workaround for this?
@zmunro run those steps one by one in your terminal, you will be able to read and troubleshoot the error.
For MacOS, this worked: https://github.com/CircleCI-Public/circleci-cli/issues/391#issuecomment-610159689 Looks like was regression