1. Trigger CI pipeline preconditions
- Add the project root directory
.gitlab-ci.yml
File to define pipeline(Build task) - Configure the Runner used by the project
2. Install Gitlab – Runner
Official Installation Instructions
Centos is used in this test, and the installation instructions are as follows:
$ curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | sudo bash
$ sudo yum install gitlab-runner
Copy the code
3. Register Runner and bind to the project
Go to GitLab’s project Settings –> CI/CD –> Runners to get the URL and tokens and then register Runner:
$ sudo gitlab-runner register
Copy the code
The command is executed by asking for a URL and token and selecting exector, where shell is selected. Once complete, the newly registered Runner is displayed in Settings -> CI/CD -> Runners.
< span style = “box-sizing: border-box; word-break: inherit! Important; word-break: inherit! Important; word-break: inherit! Important;
4. Problem record
1. Host key verification failed.
Error: Install Runner on server A, try to copy file to server B using SCP
The gitlab-runner user will be automatically created during the installation of gitlab-runner, and the user is actually used to log in and communicate with server B, so the key pair needs to be generated in /home/gitlab-runner/.ssh/. Place the public key in authorized_keys of server B.
If it still fails, you need to manually SSH < server B user@server B_Ip> when logging in as user gitlab-runner to add server B to the known_hosts.