1、搭建runner
镜像:gitlab/gitlab-runner:latest
2、注册runner,输入gitlab-runner register
命令
root@runner-6f49c57c49-5889v:/# gitlab-runner register
Runtime platform arch=amd64 os=linux pid=1054 revision=81ab07f6 version=16.10.0
Running in system-mode. Enter the GitLab instance URL (for example, https://gitlab.com/):
https://gitlab-XXX.com.cn/ ### 输入gitlab地址
Enter the registration token:
GR1348941szPTgrFCXXXXXXXXXX ### 输入token,具体如图一
Enter a description for the runner:
[runner-6f49c57c49-5889v]: k8s-runner-cody ### description
Enter tags for the runner (comma-separated):
k8s-runner-cody ### tags 名
Enter optional maintenance note for the runner:
k8s-runner-cody
WARNING: Support for registration tokens and runner parameters in the 'register' command has been deprecated in GitLab Runner 15.6 and will be replaced with support for authentication tokens. For more information, see https://docs.gitlab.com/ee/ci/runners/new_creation_workflow
Registering runner... succeeded runner=GR1348941szPTgrFC
Enter an executor: docker, docker-windows, docker-autoscaler, ssh, shell, parallels, virtualbox, docker+machine, kubernetes, instance, custom:
shell ### 填shell
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!Configuration (with the authentication token) was saved in "/etc/gitlab-runner/config.toml"
图一:
如果出现报错:tls: failed to verify certificate: x509: certificate signed by unknown authority
,需要将证书加到/usr/local/share/ca-certificates/
目录下,再执行update-ca-certificates