Add support for other views job filter
Add support for other views job filter for views. Change-Id: I80a8e82f8396df1dab2799781555c4a61942f34e Signed-off-by: Anil Belur <askb23@gmail.com>
This commit is contained in:
parent
d9f88828ad
commit
940466d7e0
@ -155,6 +155,13 @@ to the :ref:`view_list` definition.
|
||||
* **max-builds-to-match** ('int'): Maximum builds to match.
|
||||
(default 0)
|
||||
|
||||
* **other-views** (`dict`)
|
||||
:other-views:
|
||||
* **match-type** ('str'): Jobs that match a filter
|
||||
to include. (default includeMatched)
|
||||
* **view-name** ('str'): View name.
|
||||
(default select a view other than this one)
|
||||
|
||||
* **columns** (`list`): List of columns to be shown in view.
|
||||
* **regex** (`str`): . Regular expression for selecting jobs
|
||||
(optional)
|
||||
@ -393,6 +400,20 @@ class List(jenkins_jobs.modules.base.Base):
|
||||
convert_mapping_to_xml(pr_xml, pr_data, mapping,
|
||||
fail_required=True)
|
||||
|
||||
if jobfilter == 'other-views':
|
||||
ov_xml = XML.SubElement(job_filter_xml,
|
||||
'hudson.views.OtherViewsFilter')
|
||||
ov_xml.set('plugin', 'view-job-filters')
|
||||
ov_data = jobfilters.get('other-views')
|
||||
mapping = [
|
||||
('match-type', 'includeExcludeTypeString',
|
||||
'includeMatched'),
|
||||
('view-name', 'otherViewName',
|
||||
'<select a view other than this one>'),
|
||||
]
|
||||
convert_mapping_to_xml(ov_xml, ov_data, mapping,
|
||||
fail_required=True)
|
||||
|
||||
c_xml = XML.SubElement(root, 'columns')
|
||||
columns = data.get('columns', DEFAULT_COLUMNS)
|
||||
|
||||
|
28
tests/views/fixtures/view_list_otherviews_filter_full.xml
Normal file
28
tests/views/fixtures/view_list_otherviews_filter_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.OtherViewsFilter plugin="view-job-filters">
|
||||
<includeExcludeTypeString>includeMatched</includeExcludeTypeString>
|
||||
<otherViewName>&lt;select a view other than this one&gt;</otherViewName>
|
||||
</hudson.views.OtherViewsFilter>
|
||||
</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_list_otherviews_filter_full.yaml
Normal file
11
tests/views/fixtures/view_list_otherviews_filter_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:
|
||||
other-views:
|
||||
match-type: includeMatched
|
||||
view-name: '<select a view other than this one>'
|
||||
recurse: true
|
||||
status-filter: false
|
28
tests/views/fixtures/view_list_otherviews_filter_min.xml
Normal file
28
tests/views/fixtures/view_list_otherviews_filter_min.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.OtherViewsFilter plugin="view-job-filters">
|
||||
<includeExcludeTypeString>includeMatched</includeExcludeTypeString>
|
||||
<otherViewName>&lt;select a view other than this one&gt;</otherViewName>
|
||||
</hudson.views.OtherViewsFilter>
|
||||
</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>
|
10
tests/views/fixtures/view_list_otherviews_filter_min.yaml
Normal file
10
tests/views/fixtures/view_list_otherviews_filter_min.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
name: list-view-name01
|
||||
view-type: list
|
||||
description: 'Sample description'
|
||||
filter-executors: true
|
||||
filter-queue: true
|
||||
job-filters:
|
||||
other-views:
|
||||
match-type: includeMatched
|
||||
recurse: true
|
||||
status-filter: false
|
Loading…
Reference in New Issue
Block a user