如何防止某些Jenkins作业同时运行? [英] How to prevent certain Jenkins jobs from running simultaneously?

查看:98
本文介绍了如何防止某些Jenkins作业同时运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个使用共享资源(数据库)的作业,有时这会在(稀有)事件中导致作业同时触发而导致构建失败.

I have a couple of jobs that use a shared resource (database), which sometimes can cause builds to fail in the (rare) event that the jobs happen to get triggered simultaneously.

例如,给出作业A到E,是否有任何方法可以指定A和C 永远不能同时运行?

Given jobs A through E, for example, is there any way to specify that A and C should never be run concurrently?

除上述资源外,构建版本彼此独立(例如,不存在上游/下游关系).

Other than the aforementioned resource, the builds are independent of each other (not e.g. in a upstream/downstream relation).

一种强力"方式将执行者的数量限制为一个,但是如果大多数作业可以很好地同时执行并且在构建服务器上不缺少计算资源,那显然不是理想的选择.

A "brute-force" way would be limiting number of executors to one, but that obviously is less than ideal if most jobs could well be executed concurrently and there's no lack of computing resources on the build server.

推荐答案

当前有两种方法可以做到这一点:

There are currently 2 ways of doing this:

  • 使用 Throttle并发构建插件.
  • 将这些作业设置为在只有1个执行程序的从属服务器上运行.
  • Use the Throttle Concurrent Builds plugin.
  • Set up those jobs to run on a slave having only 1 executor.

这篇关于如何防止某些Jenkins作业同时运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆