Skip to content

Instantly share code, notes, and snippets.

@roshnet
Created September 16, 2022 09:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roshnet/05b2198bcb3f52e6acc7afb1da6a4105 to your computer and use it in GitHub Desktop.
Save roshnet/05b2198bcb3f52e6acc7afb1da6a4105 to your computer and use it in GitHub Desktop.
Local GitLab CI installation

Run GitLab CI jobs locally

  1. Get runner image - docker pull gitlab/gitlab-runner:latest
  2. Clone & change into source code dierctory (ensure .gitlab-ci.yml exists and is valid) - cd <REPO>
  3. Start a container called gitlab-runner0 -
docker run -d \--name gitlab-runner0 \
   --restart always \
   -v $PWD:$PWD \
   -v /var/run/docker.sock:/var/run/docker.sock \
   gitlab/gitlab-runner:latest
  1. Add directory exception (should run in project root) - docker exec -it -w $PWD gitlab-runner0 git config --global --add safe.directory $PWD
  2. Suppose job name is build-p2-master, then run job with - docker exec -it -w $PWD gitlab-runner0 gitlab-runner exec docker build-p2-master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment