Get the App
SLTechnology News&Howtos  ›  Servers  › 

Install and configure gitlab-runner in linux

Shulou Source: shulou.com Published: 2022-06-03 02:37:27 10月03日 Update

Introduction to gitlab-runner:

GitLab-Runner is used in conjunction with GitLab-CI. Generally, every project in GitLab defines a software integration script that belongs to the project, which is used to automate some software integration work. When the warehouse code of the project changes, for example, someone push the code, GitLab will notify GitLab-CI of the change. At this point, GitLab-CI finds the Runner associated with the project and tells the Runner to update the code locally and execute the predefined execution script.

So, GitLab-Runner is something that executes software integration scripts. You can imagine: Runner is like individual workers, and GitLab-CI is a management center for these workers. All workers have to register in GitLab-CI and indicate which project they work for. When the corresponding project changes, GitLab-CI will notify the appropriate workers to execute the software integration script.

GNU / Linux install gitlab-runner:

It is installed on a server different from the location where GitLab is installed.

1. Download gitlab-runner binary executable source file x86-64

Sudo wget-O / usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64

two。 Give executable permissions to the source file

Sudo chmod + x / usr/local/bin/gitlab-runner

3. Create a gitlab-runner user

Sudo useradd-- comment 'GitLab Runner'-- create-home gitlab-runner-- shell / bin/bash

4. Install, start

Sudo gitlab-runner install-user=gitlab-runner-working-directory=/home/gitlab-runner

Script execution user and gitlab-runner working directory can be specified during installation

Sudo gitlab-runner start

Obtain tokens and gitlab server domain names for shared or specific Runner through the interface of GitLab

(enter gitlab Project-> Settings-> CI/CD- > Runners- > Setup a specific Runner manually)

1. Register

Sudo gitlab-runner register

two。 Enter the relevant configuration according to the prompt

Please enter the gitlab-ci coordinator URL (e.g. Https://gitlab.com)

Https://gitlab.com (enter GitLab instance URL)

Please enter the gitlab-ci token for this runner

Xxx (enter runner registration token)

Please enter the gitlab-ci tags for this runner (comma separated):

My-tag (input runner tag can be modified on the UI page of gitlab)

Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:

Shell (enter the runner script execution environment)

After successful registration of this project in gitlab

On the Settings-> CI/CD- > Runners page, a new runner tag tag appears as the tag tag content you just entered.

Tags: Projects scripts inputs workers software code tags services tokens that is servers source files users pages changes jobs configurations differences success things Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information NVidia MariaDB Shulou Tech Info Xiaomi