Merge "Add support for most recent job filters"
This commit is contained in:
commit
9663d32c60
@ -27,6 +27,11 @@ to the :ref:`view_list` definition.
|
||||
* **filter-queue** (`bool`): Show only included jobs in builder
|
||||
queue. (default false)
|
||||
* **job-name** (`list`): List of jobs to be included.
|
||||
* **job-filters** (`dict`): Job filters to be included.
|
||||
:most-recent: * **max-to-include** (`int`): Maximum number of jobs
|
||||
to include. (default 0)
|
||||
* **check-start-time** (`bool`): Check job start time
|
||||
(default false)
|
||||
* **columns** (`list`): List of columns to be shown in view.
|
||||
* **regex** (`str`): . Regular expression for selecting jobs
|
||||
(optional)
|
||||
@ -88,7 +93,23 @@ class List(jenkins_jobs.modules.base.Base):
|
||||
if jobnames is not None:
|
||||
for jobname in jobnames:
|
||||
XML.SubElement(jn_xml, 'string').text = str(jobname)
|
||||
XML.SubElement(root, 'jobFilters')
|
||||
|
||||
job_filter_xml = XML.SubElement(root, 'jobFilters')
|
||||
jobfilters = data.get('job-filters', [])
|
||||
|
||||
mapping = [
|
||||
('max-to-include', 'maxToInclude', '0'),
|
||||
('check-start-time', 'checkStartTime', False),
|
||||
]
|
||||
|
||||
for jobfilter in jobfilters:
|
||||
if 'most-recent' in jobfilter:
|
||||
mr_xml = XML.SubElement(job_filter_xml,
|
||||
'hudson.views.MostRecentJobsFilter')
|
||||
mr_xml.set('plugin', 'view-job-filters')
|
||||
mr_data = jobfilter.get('most-recent')
|
||||
convert_mapping_to_xml(mr_xml, mr_data, mapping,
|
||||
fail_required=True)
|
||||
|
||||
c_xml = XML.SubElement(root, 'columns')
|
||||
columns = data.get('columns', DEFAULT_COLUMNS)
|
||||
|
28
tests/views/fixtures/view_most_recent_full.xml
Normal file
28
tests/views/fixtures/view_most_recent_full.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.ListView>
|
||||
<name>list-view-name01</name>
|
||||
<description>Sample description</description>
|
||||
<filterExecutors>true</filterExecutors>
|
||||
<filterQueue>true</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
<jobNames>
|
||||
<comparator class="hudson.util.CaseInsensitiveComparator"/>
|
||||
</jobNames>
|
||||
<jobFilters>
|
||||
<hudson.views.MostRecentJobsFilter plugin="view-job-filters">
|
||||
<maxToInclude>25</maxToInclude>
|
||||
<checkStartTime>true</checkStartTime>
|
||||
</hudson.views.MostRecentJobsFilter>
|
||||
</jobFilters>
|
||||
<columns>
|
||||
<hudson.views.StatusColumn/>
|
||||
<hudson.views.WeatherColumn/>
|
||||
<hudson.views.JobColumn/>
|
||||
<hudson.views.LastSuccessColumn/>
|
||||
<hudson.views.LastFailureColumn/>
|
||||
<hudson.views.LastDurationColumn/>
|
||||
<hudson.views.BuildButtonColumn/>
|
||||
</columns>
|
||||
<recurse>true</recurse>
|
||||
<statusFilter>false</statusFilter>
|
||||
</hudson.model.ListView>
|
11
tests/views/fixtures/view_most_recent_full.yaml
Normal file
11
tests/views/fixtures/view_most_recent_full.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
name: list-view-name01
|
||||
view-type: list
|
||||
description: 'Sample description'
|
||||
filter-executors: true
|
||||
filter-queue: true
|
||||
job-filters:
|
||||
- most-recent:
|
||||
max-to-include: 25
|
||||
check-start-time: true
|
||||
recurse: true
|
||||
status-filter: false
|
Loading…
Reference in New Issue
Block a user