I setup up gitlab-runner on my machine to run from a docker container as per these instructions. Then I try to run it with this command:
docker run -v /etc/gitlab-runner:/etc/gitlab-runner --rm -it gitlab/gitlab-runner exec docker test
I expect that this will run the ‘test’ stage of my .gitlab-ci.yml file using the ‘docker’ executor. Instead it exits with this message:
fatal: not a git repository (or any of the parent directories): .git
I also tried it with "–env CI_PROJECT_DIR=." but got the same result. Do I need to set some variable so that it will know what Git repo to clone? Or is it easier to just install the ‘gitlab-runner’ binary on my Linux box and use that for CLI testing?
2
Answers
From the docs:
doesn't seem to work at all in CLI.
docker run –rm -v $PWD:$PWD -v /var/run/docker.sock:/var/run/docker.sock -v /opt/gitlab-runner/config:/etc/gitlab-runner –workdir $PWD gitlab/gitlab-runner exec docker deploy. Option –workdir is the key.
Use GitLab CI to run tests locally?