首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gitlab runner +自动缩放+缩放runner选项

Gitlab runner +自动缩放+缩放runner选项
EN

Stack Overflow用户
提问于 2017-02-24 14:10:39
回答 1查看 1.1K关注 0票数 12

我正在使用gitlab runner和docker+machine executor在亚马逊网络服务上启动自动缩放的runner。我想在运行器中使用docker-in-docker设置来构建容器,但是我不知道如何为衍生的运行器定义所需的[runners.docker]属性来启用docker的使用。

有没有可能以某种方式将一些配置信息传递给自动缩放的运行器?

EN

回答 1

Stack Overflow用户

发布于 2017-03-30 18:35:56

你只需要在你的自动缩放运行器的config.toml中:

代码语言:javascript
复制
[runners.docker]
  privileged = true

我使用docker- in -docker构建自己的php容器用于测试,并将它们存储在gitlabs注册表中。有关构建示例,请参见https://gitlab.cwd.at/docker/php/builds/21582;有关构建定义,请参见https://gitlab.cwd.at/docker/php/blob/master/.gitlab-ci.yml

请看这里我的当前配置-它使用S3进行缓存,digitalocean用于跑步者:

代码语言:javascript
复制
concurrent = 10

[[runners]]
  name = "ec2-autoscale-runner"
  url = "https://gitlab.mydomain.at/ci"
  token = "12345"
  executor = "docker+machine"
  limit = 10
  environment = ["COMPOSER_CACHE_DIR=/cache"]
  [runners.machine]
    OffPeakPeriods = [               # Set the Off Peak time mode on for:
      "* * 0-9,18-23 * * mon-fri *", # - Monday to Friday for 12am to 9am and 6pm to 11pm
      "* * * * * sat,sun *"          # - whole Saturday and Sunday
    ]
    OffPeakIdleCount = 0             # There must be 1 machine in Idle state - when Off Peak time mode is on
    OffPeakIdleTime = 3550           # Each machine can be in Idle state up to 1200 seconds (after this it will be removed) - when Off Peak time mode is on
    IdleCount = 0                    # There must be 5 machines in Idle state - when Off Peak time mode is off
    IdleTime = 3550                  # Each machine can be in Idle state up to 600 seconds (after this it will be removed) - when Off Peak time mode is off
    MaxBuilds = 100                    # Each machine can handle up to 100 builds in a row (after this it will be removed)
    MachineName = "auto-scale-%s"    # Each machine will have a unique name ('%s' is required)
    MachineDriver = "digitalocean"   # Docker Machine is using the 'digitalocean' driver
    MachineOptions = [
        "digitalocean-image=21937863",
        #"digitalocean-image=20969606",
        "digitalocean-access-token=12345",
        "digitalocean-region=fra1",
        "digitalocean-size=4gb",
        "digitalocean-private-networking",
        "digitalocean-ipv6=true"
    ]
  [runners.ssh]
    user = "root"
    identity_file = "/etc/gitlab-runner/id_rsa"
  [runners.docker]
    privileged = true
  [runners.cache]
    Type = "s3"
    ServerAddress = "s3.amazonaws.com"
    AccessKey = "1234"
    SecretKey = "1234"
    BucketName = "cwd-gitlab-cache"
    BucketLocation = "eu-central-1"
    Insecure = false
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42431956

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档