Merge "Support version 2.0 and greater of the Priority Sorter Plugin"

This commit is contained in:
Zuul 2018-02-22 03:14:14 +00:00 committed by Gerrit Code Review
commit 324e0197c4
7 changed files with 40 additions and 6 deletions

View File

@ -497,17 +497,33 @@ def priority_sorter(registry, xml_parent, data):
<Priority+Sorter+Plugin>`.
:arg int priority: Priority of the job. Higher value means higher
priority, with 100 as the standard priority. (required)
priority, with 3 as the default priority. (required)
Example:
.. literalinclude:: /../../tests/properties/fixtures/priority_sorter.yaml
.. literalinclude::
/../../tests/properties/fixtures/priority_sorter002.yaml
:language: yaml
"""
priority_sorter_tag = XML.SubElement(xml_parent,
'hudson.queueSorter.'
'PrioritySorterJobProperty')
mapping = [('priority', 'priority', None)]
plugin_info = registry.get_plugin_info('Priority Sorter Plugin')
version = pkg_resources.parse_version(plugin_info.get('version', '0'))
if version >= pkg_resources.parse_version("2.0"):
priority_sorter_tag = XML.SubElement(xml_parent,
'jenkins.advancedqueue.priority.'
'strategy.PriorityJobProperty')
mapping = [
('use', 'useJobPriority', True),
('priority', 'priority', None)
]
else:
priority_sorter_tag = XML.SubElement(xml_parent,
'hudson.queueSorter.'
'PrioritySorterJobProperty')
mapping = [('priority', 'priority', None)]
helpers.convert_mapping_to_xml(
priority_sorter_tag, data, mapping, fail_required=True)

View File

@ -0,0 +1,3 @@
- longName: 'Priority Sorter Plugin'
shortName: 'PrioritySorter'
version: '1.0'

View File

@ -0,0 +1,3 @@
- longName: 'Priority Sorter Plugin'
shortName: 'PrioritySorter'
version: '2.0'

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<properties>
<jenkins.advancedqueue.priority.strategy.PriorityJobProperty>
<useJobPriority>true</useJobPriority>
<priority>3</priority>
</jenkins.advancedqueue.priority.strategy.PriorityJobProperty>
</properties>
</project>

View File

@ -0,0 +1,3 @@
properties:
- priority-sorter:
priority: 3