阅读有关自动缩放的文档,当使用 docker+machine 作为 executor 时,我无法确定 [runner.docker] 部分的作用:
[runners.docker]
image = "ruby:2.1" # The default image used for builds is 'ruby:2.1'
在执行者文档中它说:
docker+machine : 类似于 docker,但使用自动缩放的 docker 机器 - 这需要存在 [runners.docker] 和 [runners.machine]
我知道我必须定义这个 [runners.docker] 部分才能使用 [runners.machine] 部分,但是这个 [runners.docker] 的目的是什么?我找不到如何配置它,因为我不明白为什么要使用它。
我们的 gitlab-runner 在 vSphere VM 上运行,并配置为使用 docker+machine 执行器和使用 vmwarevsphere 的 MachineDriver 进行扩展。一切都很好,但我想完全理解配置文件。
这是我们的“星号审查”config.toml 文件,其中包含我无法理解的 [runners.docker](请注意,编写它的人离开了公司,所以我不能问他):
[[runners]]
name = "gitlab-runner"
limit = 6
output_limit = 102400
url = "http://gitlab.**************.lan"
token = "*******************"
executor = "docker+machine"
[runners.docker]
tls_verify = false
image = "docker:latest"
dns = ["*.*.*.*"]
privileged = true
disable_cache = false
volumes = ["/etc/localtime:/etc/localtime:ro", "/var/run/docker.sock:/var/run/docker.sock", "/etc/docker/certs.d:/etc/docker/certs.d", "/cache:/cache", "/builds:/builds"]
cache_dir = "cache"
shm_size = 0
[runners.cache]
Type = "s3"
ServerAddress = "*.*.*.*"
AccessKey = "*****************"
SecretKey = "*****************"
BucketName = "runner"
Insecure = true
[runners.machine]
IdleCount = 4
MaxBuilds = 10
IdleTime = 3600
MachineDriver = "vmwarevsphere"
MachineName = "gitlab-runner-pool-1-%s"
MachineOptions = ["vmwarevsphere-username=************", "vmwarevsphere-password=*****************", "vmwarevsphere-vcenter=*.*.*.*", "vmwarevsphere-datastore=*********", "vmwarevsphere-memory-size=3096", "vmwarevsphere-disk-size=40960", "vmwarevsphere-cpu-count=3", "vmwarevsphere-network=*****************", "vmwarevsphere-datacenter=**************", "vmwarevsphere-hostsystem=*******************", "engine-storage-driver=overlay2", "engine-insecure-registry=**************", "engine-insecure-registry=*******************"]
OffPeakPeriods = ["* * 0-8,21-23 * * mon-fri *", "* * * * * sat,sun *"]
OffPeakTimezone = "Local"
OffPeakIdleCount = 1
OffPeakIdleTime = 600