这是一个非常基础的问题,但我没有找到(好的)文档;下面是答案:
- 我可以在同一台服务器上设置/运行多个runner吗?
- “runner”是什么意思?它是(全能式)安装还是我使用例如
/opt/gitlab-runner/bin/runner
启动的进程? - 关于
/opt/gitlab-runner/bin/runner
:启动多个这样的进程有意义吗? (它们不会单独显示在gitlab-ci网络视图的“Runners”选项卡下)
谢谢。
这是一个非常基础的问题,但我没有找到(好的)文档;下面是答案:
/opt/gitlab-runner/bin/runner
启动的进程?/opt/gitlab-runner/bin/runner
:启动多个这样的进程有意义吗? (它们不会单独显示在gitlab-ci网络视图的“Runners”选项卡下)谢谢。
如果有其他人在Windows上尝试运行多个GitLab Runner:
gitlab-runner-windows-amd64.exe install -n dockerbuilder
你可以运行多个GitLab Runner实例,但从GitLab 12.2版本开始,需要注意以下重要事项: https://docs.gitlab.com/runner/faq/README.html#why-cant-i-run-more-than-one-instance-of-runner
为什么不能运行多个Runner实例?
你可以运行多个实例,但是不要共享同一个config.toml文件。
如果使用相同的配置文件运行多个Runner实例会导致意外的和难以调试的行为。在GitLab Runner 12.2版本中,每次只有一个Runner实例能够使用特定的config.toml文件。
concurrent = 10
check_interval = 0
# ... etc...
[session_server]
session_timeout = 1800
config.toml
中的配置):# register the first runner
gitlab-runner register \
--non-interactive \
--url "https://${HOSTNAME}/" \
--registration-token "${REGISTRATION_TOKEN}" \
--executor "docker" \
--tag-list "docker" \
--run-untagged="true" \
--config="/etc/gitlab-runner/config.toml"
# ... etc
# register the second runner
gitlab-runner register \
--non-interactive \
--url "https://${HOSTNAME}/" \
--registration-token "${REGISTRATION_TOKEN}" \
--executor "shell" \
--tag-list "shell" \
--limit="2" \
--config="/etc/gitlab-runner/config.toml"
# ... etc
--tag-list
。注册后,只能通过GitLab UI或API进行编辑。[[runners]]
部分。它会类似于以下内容:concurrent = 10 # global/total concurrency
check_interval = 0
# ... etc...
[session_server]
session_timeout = 1800
# Specify a docker executor
[[runners]]
(...) # specific runner config, token, etc.
executor = "docker"
[runners.docker]
(...) # docker executor configuration...
# specify a shell executor
[[runners]]
(...) # specific runner config, token, etc.
executor = "shell"
limit = 2 # concurrency limit for THIS executor
gitlab-runner start
命令时,你应该在GitLab的用户界面上看到两个在线的Runner。https://docs.gitlab.com/runner/faq/#why-cant-i-run-more-than-one-instance-of-gitlab-runner
你可以运行多个Runner,但要记住以下一点: 在GitLab Runner 12.2中,由于并发问题,只能有一个GitLab Runner实例同时使用特定的config.toml文件。与此相关的问题已经关闭,并接受了解决方案运行多个指向不同config toml文件的Runner。