简体   繁体   English

如何确保构建从Node参数中选择空闲的Jenkins从站?

[英]How to ensure that a build selects an idle Jenkins slave from the Node parameter?

I am pretty new to Jenkins and need your opinion on the below Jenkins use case: 我对Jenkins很新,需要您对以下Jenkins用例的意见:

Scenario: We have 3 slaves which are selected as part of the "Node" parameter for the build. 场景:我们有3个从属选择作为构建的“Node”参数的一部分。 Each slave can and should execute only one build at a time [So, no. 每个奴隶可以而且应该一次只执行一次构建[所以,不。 of executors per node is set to 1]. 每个节点的执行程序设置为1]。 When a build is started, the build should automatically select an idle slave to execute the job. 构建开始时,构建应自动选择空闲从属以执行作业。 Please provide inputs on how this can be achieved. 请提供有关如何实现这一目标的意见。

I tried using the default Jenkins load balancer and the Least Load plugin, but did not observe any difference. 我尝试使用默认的Jenkins负载均衡器和最小负载插件,但没有观察到任何差异。 Whenever I initiate the build, the first node selected in the "Node" parameter gets selected, by default. 每当我启动构建时,默认情况下会选择“节点”参数中选择的第一个节点。

Please let me know how this can be accomplished. 请告诉我这是如何实现的。

Thanks, Praveen 谢谢,Praveen

When you parameterize a build with a node parameter, that requires the user that started the job to select the node which will execute the job. 使用节点参数参数化构建时,需要启动作业的用户选择将执行作业的节点。 The user is probably not well equipped to choose a node which is not busy. 用户可能没有足够的能力来选择不忙的节点。

You could instead use the "Advanced" section of the job definition and "restrict where this project can be run". 您可以改为使用作业定义的“高级”部分,并“限制此项目的运行位置”。 That field allows you to define a label expression which will select the nodes allowed to run the job. 该字段允许您定义标签表达式,该表达式将选择允许运行作业的节点。 Make that label expression match all three of your slave nodes, and then Jenkins will select one of the idle nodes to execute your job. 使该标签表达式与所有三个从属节点匹配,然后Jenkins将选择一个空闲节点来执行您的作业。

For instance, you could label each of your slaves as "builder", then use the label expression "builder" to have Jenkins select one of the "builder" labeled slaves as the slave to host that job. 例如,您可以将每个从属标记为“构建器”,然后使用标签表达式“构建器”让Jenkins选择一个标记为奴隶的“构建器”作为托管该作业的从属。

Or, you could insert the names of the 3 slaves into the label expression (machine1 || machine2 || machine3). 或者,您可以将3个从属的名称插入到标签表达式(machine1 || machine2 || machine3)中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Jenkins npm build无法在Windows从站上解压缩软件包 - Jenkins npm build fails to unzip a package on Windows slave 如何使用GULP / NODE在JavaScript中获取Jenkins BUILD_NUMBER? - How to get Jenkins BUILD_NUMBER in JavaScript using GULP/NODE? 如何在Jenkins中构建一个node项目,同时引用另一个node项目? - How can we build a node project in Jenkins while referencing another node project? 如何杀死Node在Redis上打开的空闲客户端? - How to kill idle clients opened by Node on Redis? Azure上的Node.js + MongoLab,如何防止网站处于空闲状态? - Node.js + MongoLab on Azure, how to prevent web site from being idle? 如何使用 Node 模块从电子应用程序中获取空闲时间? - How can use Node module to get idle time from an electron app? 无法在 jenkins 上为节点应用程序构建作业 - Unable to build job on jenkins for node application 使用节点 js 触发 Jenkins 构建 - Triggering a Jenkins build using node js 在与Jenkins一起运行的MAC OS X从站上构建Errror“ spawn spctl ENOENT” - Build Errror “spawn spctl ENOENT” on MAC OS X Slave that runs with Jenkins 如何从远程构建自动配置 jenkins 用户输入阶段? - How to automatically configure jenkins user input stage from remote build?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM