Add support for job type filter
Add support for job type filter for views. Change-Id: I6bf6af70310d4a0e590187fca3e6db6a52c4ec33 Signed-off-by: Anil Belur <askb23@gmail.com>
This commit is contained in:
parent
0361d56fdf
commit
e585287380
@ -132,6 +132,13 @@ to the :ref:`view_list` definition.
|
||||
(default '')
|
||||
* **regex** ('str'): Regular expression. (default '')
|
||||
|
||||
* **job-tpye** (`dict`)
|
||||
:job-type:
|
||||
* **match-type** ('str'): Jobs that match a filter to include.
|
||||
(default includeMatched)
|
||||
* **job-type** ('str'): Type of Job.
|
||||
(default hudson.model.FreeStyleProject)
|
||||
|
||||
* **columns** (`list`): List of columns to be shown in view.
|
||||
* **regex** (`str`): . Regular expression for selecting jobs
|
||||
(optional)
|
||||
@ -337,6 +344,19 @@ class List(jenkins_jobs.modules.base.Base):
|
||||
convert_mapping_to_xml(rj_xml, rj_data, mapping,
|
||||
fail_required=True)
|
||||
|
||||
if jobfilter == 'job-type':
|
||||
jt_xml = XML.SubElement(job_filter_xml,
|
||||
'hudson.views.JobTypeFilter')
|
||||
jt_xml.set('plugin', 'view-job-filters')
|
||||
jt_data = jobfilters.get('job-type')
|
||||
mapping = [
|
||||
('match-type', 'includeExcludeTypeString',
|
||||
'includeMatched'),
|
||||
('job-type', 'jobType', 'hudson.model.FreeStyleProject'),
|
||||
]
|
||||
convert_mapping_to_xml(jt_xml, jt_data, mapping,
|
||||
fail_required=True)
|
||||
|
||||
c_xml = XML.SubElement(root, 'columns')
|
||||
columns = data.get('columns', DEFAULT_COLUMNS)
|
||||
|
||||
|
28
tests/views/fixtures/view_list_jobtype_filter_full.xml
Normal file
28
tests/views/fixtures/view_list_jobtype_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.JobTypeFilter plugin="view-job-filters">
|
||||
<includeExcludeTypeString>includeMatched</includeExcludeTypeString>
|
||||
<jobType>hudson.model.FreeStyleProject</jobType>
|
||||
</hudson.views.JobTypeFilter>
|
||||
</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_jobtype_filter_full.yaml
Normal file
11
tests/views/fixtures/view_list_jobtype_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:
|
||||
job-type:
|
||||
match-type: includeMatched
|
||||
job-tpye: hudson.model.FreeStyleProject
|
||||
recurse: true
|
||||
status-filter: false
|
28
tests/views/fixtures/view_list_jobtype_filter_min.xml
Normal file
28
tests/views/fixtures/view_list_jobtype_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.JobTypeFilter plugin="view-job-filters">
|
||||
<includeExcludeTypeString>includeMatched</includeExcludeTypeString>
|
||||
<jobType>hudson.model.FreeStyleProject</jobType>
|
||||
</hudson.views.JobTypeFilter>
|
||||
</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_jobtype_filter_min.yaml
Normal file
10
tests/views/fixtures/view_list_jobtype_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:
|
||||
job-type:
|
||||
match-type: includeMatched
|
||||
recurse: true
|
||||
status-filter: false
|
Loading…
x
Reference in New Issue
Block a user