问题
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.
I left Build Parameter Name = "BuildPriority".
Starting the Job via:
http://localhost:8080/job/myJobName/buildWithParameters?PARAM1=value1&PARAM2=value2&BuildPriority=1
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?
Many thanks in advance,
marcus
Update:
I found this related Bug already tracked: https://issues.jenkins-ci.org/browse/JENKINS-22294
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.
回答1:
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.
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.
来源:https://stackoverflow.com/questions/24145115/jenkins-priority-sorter-plugin-how-to-use-buildpriority-parameter