Jenkins-资源管理 [英] Jenkins - resource management

查看:112
本文介绍了Jenkins-资源管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以在詹金斯管理一些资源吗?我的意思是说,只有一定数量的作业可以并行运行.例如.我的许可证服务器只能提供4个许可证,因此使用该许可证的每个作业应首先检查某个计数器是否大于零,然后再减少并在不再需要许可证后递减.有排除插件,但我认为它只能创建互斥量(计数器等于1),不能创建信号量(计数器等于1或更大).脚本中的简单变量不是解决方案,因为主机和所有从机都必须可见相同的计数器. 有什么想法如何处理吗? 提前致谢.

is it possible to manage some resources in Jenkins? By that I mean only certain number of jobs should run in parallel. E.g. my license server can provide only 4 licenses, so each job that uses such license should first check if some counter is greater that zero, next decrement and increment back after license is not needed anymore. There is Exclusion Plugin, but I think it can only create mutex (counter equals 1) not semaphore (counter equals 1 or more). Simple variable in script is not a solution, because same counter must be visible by master and all slaves. Any ideas how to handle that? Thanks in advance.

推荐答案

您可以使用油门并发构建插件.您可以通过两种方式做到这一点:

You can use the Throttle Concurrent Builds Plugins. You can do it in two ways:

  • 如果限制仅适用于一项作业,则可以编辑作业本身.有一个油门并发构建设置,您可以在其中配置允许同一作业进行多少个并发构建.
  • 如果必须限制多个作业,则可以在全局配置中定义多项目油门类别.您定义一个具有限制的类别,然后用该类别标记必须限制的每个作业.
  • If the restriction applies to only one job, you can edit the job itself. There is a Throttle Concurrent Builds setting, where you can configure how many concurrent builds of the same job are allowed.
  • If there are multiple jobs that have to be restricted, then you can define Multi-Project Throttle Categories in the global configuration. You define a category with a restriction, and then tag every job that has to be restricted with this category.

这篇关于Jenkins-资源管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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