aws ec2 上的 Gitlab 运行程序:让一个 ec2 启动多个并发作业

问题描述 投票:0回答:2

我遵循了本教程:https://docs.gitlab.com/runner/configuration/runner_autoscale_aws/

而且效果非常好!我将运行器仅放在一个分支中进行测试但是在我们的管道中,一个阶段有大约 15 个作业,但我的配置仅启动 2 台 ec2 机器,因此一次只执行 2 个作业,但我希望一台机器执行 4 个作业-5 个工作同时进行

我的同台工作:https://i.stack.imgur.com/g8Ybz.jpg

这是我的config.toml

concurrent = 8
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "gitlab-runner-xxxxx-dev"
  url = "https://gitlab.com/"
  token = "xxxxxxxxx"
  executor = "docker+machine"
  limit = 2
  request_concurrency = 3
  [runners.docker]
    image = "alpine"
    privileged = true
    disable_cache = true
  [runners.cache]
    Type = "s3"
    Shared = true
    [runners.cache.s3]
      ServerAddress = "s3.amazonaws.com"
      AccessKey = "xxxxxxxx"
      SecretKey = "xxxxx"
      BucketName = "gitlab-runner-xxx-bucket"
      BucketLocation = "eu-west-3"
  [runners.machine]
    IdleCount = 0
    IdleTime = 1800
    MaxBuilds = 10
    MachineDriver = "amazonec2"
    MachineName = "gitlab-docker-machine-%s"
    MachineOptions = [
      "amazonec2-access-key=xxxxxx",
      "amazonec2-secret-key=xxxxxxx",
      "amazonec2-region=eu-west-3",
      "amazonec2-vpc-id=vpc-xxxx",
      "amazonec2-subnet-id=subnet-xxxxx",
      "amazonec2-use-private-address=true",
      "amazonec2-tags=runner-manager-name,gitlab-aws-autoscaler,gitlab,true,gitlab-runner-autoscale,true",
      "amazonec2-security-group=xxxxx",
      "amazonec2-instance-type=m5.large",
    ]
    [[runners.machine.autoscaling]]
      Periods = ["* * 9-18 * * mon-fri *"]
      IdleCount = 2
      IdleTime = 3600
      Timezone = "UTC"
    [[runners.machine.autoscaling]]
      Periods = ["* * * * * sat,sun *"]
      IdleCount = 1
      IdleTime = 60
      Timezone = "UTC"

我的配置不适合我想要的东西还是我想要的东西是不可能的? 谢谢大家!

amazon-ec2 devops gitlab-ci-runner autoscaling
2个回答
0
投票

您已在配置中设置了

limit = 2
。这会将配置文件中定义的所有运行器处理的作业总数限制为 2。

将此限制设置为更高的数字以允许更多作业同时运行。

另请参阅 limit

concurrent
IdleCount
 之间的 
关系。


0
投票

显然是的,如果你使用 docker-machine,这就是限制,一台主机一次只能处理一项作业。 GitLab 不想投入时间来改进过时的 docker 机器,在很长一段时间内甚至 Docker 都不支持它,相反,他们希望你切换到短暂的插件,对于 AWS 有一个自动缩放的测试版,你可以检查一下。根据文档,它应该支持在工作之间共享保险。

© www.soinside.com 2019 - 2024. All rights reserved.