「GitLab CI/CD」- 常用 GitLab Runner 管理

注册 Executor 服务

Registering runners | GitLab

# 通过交互完成注册
gitlab-runner register
...

# 通过命令直接注册
gitlab-runner register   --non-interactive                 \
    --url "https://gitlab.com/"                            \
    --registration-token "sBZ7xHzxTz6Ec9mYb1yp"            \
    --executor "docker" --docker-image ubuntu:latest       \
    --tag-list "build-in-docker,executor=docker"           \
    --run-untagged="true"

gitlab-runner register                                     \
  --non-interactive                                        \
  --url "https://your.gitlab.server.com/"                  \
  --registration-token "YOUR_REGISTRATION_TOKEN"           \
  --executor "ssh"                                         \
  --ssh-host "REMOTE_SERVER_IP"                            \
  --ssh-port "22"                                          \
  --ssh-user "REMOTE_SERVER_USERNAME"                      \
  --ssh-password "REMOTE_SERVER_PASSWORD"                  \
  --ssh-identity-file "/path/to/ssh/private/key"           \
  --tag-list "ssh,linux"

配置重新加载

GitLab Runner commands/Signals

kill -SIGHUP <main_runner_pid>

并行执行任务数

Advanced configuration/The global section

默认注册的 GitLab Runner Executor 的 concurrent 为 1 即无法并行进行构建任务。

标签说明

docker:
run on