The process of setting up a runner to perform Gitlab CI tests on your personal forks is both very easy and very useful. After setting up a runner for your personal repositories, they will automatically run any CI jobs set up in the repo's .gitlab-ci.yaml file after a commit. This allows you to run the CI pipeline and get test results to make sure your repository is compliant with tests before merging into the main repository.
What You Will Need
You will need a Gitlab-CI Coordinator URL and a Gitlab-CI Token to register your runner. To obtain these:
Navigate to your repository's homepage
Select Settings -> CI / CD -> Runners
In the left column labelled Specific Runners, you should see a field labelled Set up a specific Runner manually
Step 2 contains your Gitlab-CI Coordinator URL
Step 3 contains your Gitlab-CI Token
NOTE: To obtain these items, you need to be a Maintainer on the repository. If you are not a Maintainer, you will need to obtain these items from a Maintainer.
Installing and Registering gitlab-runner
Install the gitlab-runner package from community repositories. On Ubuntu: apt install gitlab-runner. This will install the needed packages and also create a gitlab-runner user.
Register your runner using sudo gitlab-runner register:
Enter the Gitlab-CI Coordinator URL found earlier
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):https://gitlab.com/
Enter the Gitlab-CI Token found earlier
Please enter the gitlab-ci token for this runner:xxx
Enter a description for the Runner. Default is machine's hostname. This can be changed later in the Gitlab UI's CI / CD settings.
Please enter the gitlab-ci description for this runner:[hostname]:
Please enter the executor: shell, docker+machine, parallels, docker-ssh, ssh, virtualbox, docker-ssh+machine, kubernetes, docker:shell
Start the runner: sudo gitlab-runner start
Verify the runner was created and is alive: sudo gitlab-runner listsudo gitlab-runner verify
Disabling Shared Runners
Now that you have a personal runner set up, you should disable shared runners for your project. Shared runners are a bank of runners that can be made available, but they may not have the capabilities or dependencies that you need to successfully complete a build. To disable shared runners:
Go to Settings -> CI / CD -> Runners
In the right column labelled Shared Runners, click Disable shared runners
While you are here, check the left column to find the runner you just registered