从几天以来我一直在Gitlab CI附近工作。我已经用spot实例将EC2 -ASG设置为runner。
我想知道我们是否有任何解决方案,以便在工作成功后立即删除spot实例。
下面是gitlab运行程序的配置。
concurrent = 2
check_interval = 3
[session_server]
session_timeout = 1800
[[runners]]
name = "shell-runner"
url = "https://gitlab.com/"
token = "xxxx-xxxx"
executor = "shell"
limit = 1
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[[runners]]
name = "docker-machine-runner"
url = "https://gitlab.com/"
token = "xxxx-xyxyxyxy"
executor = "docker+machine"
limit = 1
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[runners.docker]
tls_verify = false
image = "docker:latest"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
[runners.machine]
IdleCount = 0
IdleTime = 1800
MaxBuilds = 100
MachineDriver = "amazonec2"
MachineName = "gitlab-docker-machine-%s"
MachineOptions = [
"amazonec2-region=us-west-2",
"amazonec2-ssh-user=ubuntu",
"amazonec2-vpc-id=vpc-xxxx",
"amazonec2-subnet-id=subnet-xxx",
"amazonec2-use-private-address=true",
"amazonec2-instance-type=t3a.medium",
"amazonec2-ami=ami-xxx",
"amazonec2-zone=a",
"amazonec2-security-group=gitlab-runner-sg",
"amazonec2-request-spot-instance=true",
"amazonec2-spot-price=0.025"
]我在上面的配置中有两个转轮,即外壳和对接机.
目前,它根本没有删除spot船队,如果我设置了amazonec2-block-duration-minutes=20标志,我猜它会将它保持20分钟的spot实例,然后删除它。
我正在寻找一种解决方案,以便在每个作业成功后删除spot实例,并且/或它可以等待某个时间等待其他作业并被终止。
在上述对接机运行程序中,需要进行哪些配置更改才能实现这一点?
或者我们能做任何其他的自动化来实现它吗?
如果需要更多关于同样的信息,请告诉我。
提前谢谢。
发布于 2021-01-26 17:51:42
昨天,我用如何监控跑步平台的方式回答了一个类似的问题。完整的帖子在这里:Start build on a windows ec2 with gitlab runner
我所做的,我有一个小的应用程序运行在某处,不断轮询各种Gitlab API,以检索挂起的作业数量和可用运行程序的数量。然后,根据我定义的一些阈值,我要么增加跑步者的数量,要么减少他们,直到达到一个阈值。
例如,假设我一次最多需要5个跑步者,并且在增加跑步者的数量(最多为5个)之前,我希望队列中不超过5个作业。下面是我要做的事情(从链接的帖子中复制):
H 114如果有一个或多个运行程序,则添加一个
所使用的各种API是:
https://docs.gitlab.com/ee/api/projects.html
https://stackoverflow.com/questions/65803525
复制相似问题