系统:Ubuntu 18.04.1 LTS

gitlab版本:11.9

使用gitlab服务器域名:https://gitlab.example.com

需要使用到url和token:gitlab服务器地址+/admin/runners

要在GNU / Linux下注册Runner:

  1. 运行以下命令:

    gitlab-runner register
  2. 输入您的GitLab实例URL:

     Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )
     https://gitlab.com
    
  3. 输入您获得的令牌以注册Runner:

    Please enter the gitlab-ci token for this runner
     xxx
  4. 输入Runner的描述,您可以稍后在GitLab的UI中更改:

    Please enter the gitlab-ci description for this runner
    [hostame] my-runner
  5. 输入与Runner关联标签,您可以稍后在GitLab的UI中更改:

    Please enter the gitlab-ci tags for this runner (comma separated):
    my-tag,another-tag
  6. 输入Runner执行程序

    Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:
    docker
  7. 如果您选择Docker作为执行程序,则会要求您将默认图像用于未在其中定义的项目.gitlab-ci.yml

    Please enter the Docker image (eg. ruby:2.1):
    alpine:latest

  第五步报错,报错信息如下:

ERROR: Registering runner... failed                 runner=6HkNBVen status=couldn't execute POST against https://gitlab.example.com/api/v4/runners: Post https://gitlab.example.com/api/v4/runners: x509: certificate signed by unknown authority
PANIC: Failed to register this runner. Perhaps you are having network problems


证书签名错误,在网上找了许多办法还是不行,解决办法:

gitlab-runner register \
  --non-interactive \
  --tls-ca-file=/etc/gitlab/ssl/gitlab.example.com.crt  \
  --url "https://gitlab.example.com/" \
  --registration-token "6HkNBVenPd9sMyd2HzhK" \
  --executor "docker" \
  --docker-image maven:latest \
  --description "runner " \
  --tag-list "run" \
  --run-untagged \
  --locked="false"

找到gitlab文件夹下,就看到了,把证书文件带上

其他版本注册方式:

https://docs.gitlab.com/11.9/runner/register/index.html

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐