本文介绍了Jenkins Priority Sorter插件-如何使用BuildPriority参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图动态地将优先级(从1到5)应用于通过包含BuildPriority参数的URL启动的Jenkins作业.

I am trying to dnymaically apply priorities (from 1 to 5) to Jenkins jobs started via a URL containing the BuildPriority parameter.

在优先排序器配置"中,我选择了

In the Priority Sorter Config I selected

->为作业分配优先级时使用其他规则

->Use additional rules when assigning a priority to a Job

并选择从构建参数使用优先级"作为构建策略.

and chose "Use Priority from Build Parameter" as Build Strategy.

我离开了Build Parameter Name ="BuildPriority".

I left Build Parameter Name = "BuildPriority".

通过以下方式开始工作:

Starting the Job via:

http://localhost:8080/job/myJobName/buildWithParameters?PARAM1=value1&PARAM2=value2&BuildPriority=1

不应用优先级.我尝试向名为"BuildPriority"的作业添加字符串参数,但效果不佳.我在做什么错了?

doesn't apply the priority. I tried to add a string Parameter to the Job named "BuildPriority" which didn't work as well. What am I doing wrong?

在此先感谢

马库斯

更新:

我发现此相关的Bug已经被跟踪: https://issues.jenkins-ci.org/browse/JENKINS-22294

I found this related Bug already tracked:https://issues.jenkins-ci.org/browse/JENKINS-22294

更新2:对于那些寻找解决方案的人,我可以提供一种解决方法:允许并行构建对应的作业,并将Jenkins设置中的处理器/内核数减少到1.如果您不希望使用此选项,则要使用所有内核,请安装Throttle Concurrent Builds插件,该插件可让您将每个Job自己控制到所需的尽可能多的核心.限制为1并允许并行构建使我获得了预期的行为.

Update 2:For those searching for a solution I can offer a workaround: Allow parallel builds for the corresponding job and reduce the number of processors/cores in Jenkins settings to 1. If this is not an option for you, as you want to use all cores, install Throttle Concurrent Builds Plug-in which allows you to "throttle" every Job on its own to as many cores as you want. Throttling to 1 and allowing parallel builds got me the behaviour I expected.

推荐答案

Priority Sorter插件(自具有Jenkins 2.73.3的插件版本3.6.0起)将甚至无法看到" 的队列. 作业,除非选中了Execute concurrent builds if necessary选项.

The Priority Sorter Plugin (as of Plugin Version 3.6.0 with Jenkins 2.73.3) will be prevented from even "seeing" a queue for a single Job, unless the option Execute concurrent builds if necessary is checked.

因此:允许并行构建对应的作业,并将Jenkins设置中的处理器/内核数减少为1.如果您不希望使用此选项,则要使用所有内核,请安装油门并发构建插件" ,您可以根据自己的需要将每个作业"油门"到尽可能多的核心.限制1 允许并行构建使我获得了预期的行为.

Therefore: Allow parallel builds for the corresponding job and reduce the number of processors/cores in Jenkins settings to 1. If this is not an option for you, as you want to use all cores, install Throttle Concurrent Builds Plug-in which allows you to "throttle" every Job on its own to as many cores as you want. Throttling to 1 and allowing parallel builds got me the behaviour I expected.

这篇关于Jenkins Priority Sorter插件-如何使用BuildPriority参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 19:18