Add support for job status job filter
Add support for job status job filter for views. Change-Id: Iaeace8d2f4a150ab2497f25371f18b9b62617713 Signed-off-by: Anil Belur <askb23@gmail.com>
This commit is contained in:
parent
c6ff48ce4a
commit
00f64f2e20
@ -62,6 +62,20 @@ to the :ref:`view_list` definition.
|
||||
* **status**: ('str'): Job status.
|
||||
(default Completed)
|
||||
|
||||
* **job-status** (`dict`)
|
||||
:job-status: * **match-type** ('str'): Jobs that match a filter
|
||||
to include. (default includeMatched)
|
||||
* **unstable** ('bool'): Jobs with status
|
||||
unstable. (default False)
|
||||
* **failed** ('bool'): Jobs with status
|
||||
failed. (default False)
|
||||
* **aborted** ('bool'): Jobs with status
|
||||
aborted. (default False)
|
||||
* **disabled** ('bool'): Jobs with status
|
||||
disabled. (default False)
|
||||
* **stable** ('bool'): Jobs with status
|
||||
stable. (default False)
|
||||
|
||||
* **columns** (`list`): List of columns to be shown in view.
|
||||
* **regex** (`str`): . Regular expression for selecting jobs
|
||||
(optional)
|
||||
@ -182,6 +196,23 @@ class List(jenkins_jobs.modules.base.Base):
|
||||
convert_mapping_to_xml(bt_xml, bt_data, mapping,
|
||||
fail_required=True)
|
||||
|
||||
if jobfilter == 'job-status':
|
||||
js_xml = XML.SubElement(job_filter_xml,
|
||||
'hudson.views.JobStatusFilter')
|
||||
js_xml.set('plugin', 'view-job-filters')
|
||||
js_data = jobfilters.get('job-status')
|
||||
mapping = [
|
||||
('match-type', 'includeExcludeTypeString',
|
||||
'includeMatched'),
|
||||
('unstable', 'unstable', False),
|
||||
('failed', 'failed', False),
|
||||
('aborted', 'aborted', False),
|
||||
('disabled', 'disabled', False),
|
||||
('stable', 'stable', False),
|
||||
]
|
||||
convert_mapping_to_xml(js_xml, js_data, mapping,
|
||||
fail_required=True)
|
||||
|
||||
c_xml = XML.SubElement(root, 'columns')
|
||||
columns = data.get('columns', DEFAULT_COLUMNS)
|
||||
|
||||
|
32
tests/views/fixtures/view_list_job_status_full.xml
Normal file
32
tests/views/fixtures/view_list_job_status_full.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<?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.JobStatusFilter plugin="view-job-filters">
|
||||
<includeExcludeTypeString>includeMatched</includeExcludeTypeString>
|
||||
<unstable>true</unstable>
|
||||
<failed>true</failed>
|
||||
<aborted>true</aborted>
|
||||
<disabled>true</disabled>
|
||||
<stable>true</stable>
|
||||
</hudson.views.JobStatusFilter>
|
||||
</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>
|
15
tests/views/fixtures/view_list_job_status_full.yaml
Normal file
15
tests/views/fixtures/view_list_job_status_full.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
name: list-view-name01
|
||||
view-type: list
|
||||
description: 'Sample description'
|
||||
filter-executors: true
|
||||
filter-queue: true
|
||||
job-filters:
|
||||
job-status:
|
||||
match-type: includeMatched
|
||||
unstable: true
|
||||
failed: true
|
||||
aborted: true
|
||||
disabled: true
|
||||
stable: true
|
||||
recurse: true
|
||||
status-filter: false
|
32
tests/views/fixtures/view_list_job_status_min.xml
Normal file
32
tests/views/fixtures/view_list_job_status_min.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<?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.JobStatusFilter plugin="view-job-filters">
|
||||
<includeExcludeTypeString>includeMatched</includeExcludeTypeString>
|
||||
<unstable>false</unstable>
|
||||
<failed>false</failed>
|
||||
<aborted>false</aborted>
|
||||
<disabled>false</disabled>
|
||||
<stable>false</stable>
|
||||
</hudson.views.JobStatusFilter>
|
||||
</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_job_status_min.yaml
Normal file
10
tests/views/fixtures/view_list_job_status_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-status:
|
||||
match-type: includeMatched
|
||||
recurse: true
|
||||
status-filter: false
|
Loading…
Reference in New Issue
Block a user