Add support for job priority sorter plugin.
This plugin provides a way to configure priority of jobs in build queue. Each job has a inherent, configurable, priority. Builds of higher priority are scheduled first. Change-Id: Ie7f374369a141bec094bf9a6a7438082bf298fb5 Reviewed-on: https://review.openstack.org/35064 Reviewed-by: James E. Blair <corvus@inaugust.com> Reviewed-by: Khai Do <zaro0508@gmail.com> Approved: Clark Boylan <clark.boylan@gmail.com> Reviewed-by: Clark Boylan <clark.boylan@gmail.com> Tested-by: Jenkins
This commit is contained in:
parent
654cd76439
commit
4aac895619
|
@ -330,6 +330,29 @@ def extended_choice(parser, xml_parent, data):
|
||||||
'default-property-key', '')
|
'default-property-key', '')
|
||||||
|
|
||||||
|
|
||||||
|
def priority_sorter(parser, xml_parent, data):
|
||||||
|
"""yaml: priority-sorter
|
||||||
|
Allows simple ordering of builds, using a configurable job priority.
|
||||||
|
|
||||||
|
Requires the Jenkins `Priority Sorter Plugin
|
||||||
|
<https://wiki.jenkins-ci.org/display/JENKINS/Priority+Sorter+Plugin>`_.
|
||||||
|
|
||||||
|
:arg int priority: Priority of the job. Higher value means higher
|
||||||
|
priority, with 100 as the standard priority. (required)
|
||||||
|
|
||||||
|
Example::
|
||||||
|
|
||||||
|
properties:
|
||||||
|
- priority-sorter:
|
||||||
|
priority: 150
|
||||||
|
"""
|
||||||
|
priority_sorter_tag = XML.SubElement(xml_parent,
|
||||||
|
'hudson.queueSorter.'
|
||||||
|
'PrioritySorterJobProperty')
|
||||||
|
XML.SubElement(priority_sorter_tag, 'priority').text = str(
|
||||||
|
data['priority'])
|
||||||
|
|
||||||
|
|
||||||
class Properties(jenkins_jobs.modules.base.Base):
|
class Properties(jenkins_jobs.modules.base.Base):
|
||||||
sequence = 20
|
sequence = 20
|
||||||
|
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -83,6 +83,7 @@ setuptools.setup(
|
||||||
'authenticated_build',
|
'authenticated_build',
|
||||||
'authorization=jenkins_jobs.modules.properties:authorization',
|
'authorization=jenkins_jobs.modules.properties:authorization',
|
||||||
'extended-choice=jenkins_jobs.modules.properties:extended_choice',
|
'extended-choice=jenkins_jobs.modules.properties:extended_choice',
|
||||||
|
'priority-sorter=jenkins_jobs.modules.properties:priority_sorter',
|
||||||
],
|
],
|
||||||
'jenkins_jobs.parameters': [
|
'jenkins_jobs.parameters': [
|
||||||
'string=jenkins_jobs.modules.parameters:string_param',
|
'string=jenkins_jobs.modules.parameters:string_param',
|
||||||
|
|
Loading…
Reference in New Issue