testing - Any altenatives of "gitlab-runner exec docker <job-name>" to test CI/CD locally? I get "FATAL: Command exec not found." - Stack Overflow
Testing rules with `gitlab-runner exec`
gitlab-runner exec being deprecated
How to use the docker gitlab-runner to exec stages locally - Stack Overflow
Hello, I am currently trying to create a Gitlab CI pipeline where I will be able to run tests locally on a specific runner on a Raspberry Pi. However, I have been looking around for a while now, and it seems that the command "gitlab-runner exec" is deprecated.
Is there a different solution to performing local CI on a raspberry pi, where artifacts can be fetched from the gitlab server, perform the local testing, and then push what is desired back to the gitlab server at a later date?
gitlab-runner exec works as its own standalone command and runs the job in the context of where the executable is called -- it will not cause the job to be run on a registered runner. It is solely a local operation, so you must have the binary available.
You can run gitlab-runner exec inside of your runner container or a new container if you want.
For example (assuming Linux platform):
docker run --rm \
-v $(pwd):/workspace \ # mount directory to the container
--workdir /workspace \ # set working directory
-v /var/run/docker.sock:/var/run/docker.sock \ # enable docker
--privileged \
--entrypoint="gitlab-runner" \ # set entrypoint
gitlab/gitlab-runner:latest exec docker MY_JOB
Or use doker exec to run the command on your existing container:
docker exec -it my-running-container-name gitlab-runner exec docker linting
Though, you will want to make sure the .gitlab-ci.yml file and project files are present in the container when you start it...
since gitlab 17, the feature is removed https://docs.gitlab.com/runner/commands/#gitlab-runner-exec-removed