Changing a GitLab Runner from ‘Locked to a Project’ to Shared

I have a GitLab Runner assigned to a project that I’d like to share with another similar project. Currently it looks like this:

Pressing the small edit icon, I can see these options:

I want to reuse this same runner, so I unchecked the ‘Lock to current projects’ checkbox.

Now if I go to the CI/CD settings for my other project I can see it is available, so I click ‘enable for this project’

Now my Pending Job that was triggered after my first push to my repo has kicked in and is being deployed to my test Docker server. Cool.

Assigning GitLab runners to a project

Following on from this post, Runners are added per project (unless they are shared). If you’re configuring a new project and haven’t created a new runner and assigned it to your  project, you’ll see this:

Add a new runner per the steps in the previous article.

Configure GitLab to run Docker build in a CI Pipeline

Assuming you already have an installed an running Gitlab server, you need to install and configure a GitLab runner:

Install gitlab-runner: https://docs.gitlab.com/runner/install/linux-repository.html

Run the gitlab-runner shell setup, described here: https://docs.gitlab.com/ce/ci/docker/using_docker_build.html

Get the registration token from the Settings / CI/CD Settings page.

You can now use docker commands in the script section of your .gitlab-ci.yml file defining your pipeline.