Gitlab CI. 如何配置仅为每个Runner启动一个任务?

huangapple go评论68阅读模式
英文:

Gitlab ci. How to configure the launch of only one task for each runner?

问题

如何配置每个Runner只启动一个任务,以便其他任务排队等待,而不尝试同时运行,从而破坏构建?

我有3个macOS的Runner,在config.toml文件中,对于每个[[runners]],指定了"concurrent=1"和"limit=1"。
当运行3个作业时,2个作业可以在同一个Runner上运行,导致构建崩溃,有1个Runner处于空闲状态。
当启动6个作业时,所有6个构建都失败。

我期望的是,当启动6个任务时,会完成3个任务,另外3个任务会在队列中等待,并在Runner空闲时执行。

我尝试了不同的config文件选项,但仍然遇到这个问题。

我要补充说明的是,我在三个Runner上使用了一个配置文件。这可能是个问题吗?

[[runners]]
name = "Runner 1"
url = "https://your-gitlab-instance.com/"
token = "your-runner-token"
executor = "shell"
concurrent = 1

[[runners]]
name = "Runner 2"
url = "https://your-gitlab-instance.com/"
token = "your-runner-token"
executor = "shell"
concurrent = 1

[[runners]]
name = "Runner 3"
url = "https://your-gitlab-instance.com/"
token = "your-runner-token"
executor = "shell"
concurrent = 1

英文:

How to configure the launch of only one task for each runner, so that other tasks queue up, and do not try to run at the same time, breaking the builds?

Im have 3 runners macos, in the config.toml it is indicated for each [[runners]] "concurrent= 1" "limit = 1"
When running 3 jobs, 2 jobs can run on the same runner, build crashes, 1 runner is left idle.
When start 6 jobs, all 6 builds fall.

I expect that when 6 tasks are launched, 3 tasks will be completed, 3 will be in the queue and will be executed when the runners are free.

I went through different options for the config file, but I still encounter this problem

I will add that I use one config file for three runners. could this be a problem?

[[runners]]   
  name = "Runner 1"   
  url = "https://your-gitlab-instance.com/"       
  token = "your-runner-token"   
  executor = "shell"       
  concurrent = 1  

[[runners]]   
  name = "Runner 2"       
  url = "https://your-gitlab-instance.com/"       
  token = "your-runner-token"   
  executor = "shell"   
  concurrent = 1  

[[runners]]   
  name = "Runner 3"   
  url = "https://your-gitlab-instance.com/"   
  token = "your-runner-token"    
  executor = "shell"   
  concurrent = 1

答案1

得分: 1

问题出在我的情况下,问题在于在一台Mac上安装了3个运行程序,每个运行程序都使用一个共同的config.toml文件,为每个运行程序创建一个单独的配置文件解决了这个问题。希望这对某人有帮助。

英文:

In my case the problem was that on a Mac were installed 3 services for each runner that used one common config.toml file, creating a separate config file for each runner service solved the problem.
Hope this helps someone.

huangapple
  • 本文由 发表于 2023年6月8日 17:49:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/76430613.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定