Add support for build status Job Filter plugin
Add support for build status job filter plugin for views. Change-Id: I1e9142e6eb7232341fc97545fe6a48fa0a94d46a Signed-off-by: Anil Belur <askb23@gmail.com>
This commit is contained in:
parent
55da305df0
commit
84940bb38d
@ -86,6 +86,17 @@ to the :ref:`view_list` definition.
|
||||
for all jobs in a view, if no jobs have been included by
|
||||
previous filters. (default REMOVE_ALL_IF_ALL_INCLUDED)
|
||||
|
||||
* **build-status** (`dict`)
|
||||
:build-status:
|
||||
* **match-type** ('str'): Jobs that match a filter
|
||||
to include. (default includeMatched)
|
||||
* **never-built** ('bool'): Jobs that are never
|
||||
built. (default False)
|
||||
* **building** ('bool'): Jobs that are being
|
||||
built. (default False)
|
||||
* **in-build-queue** ('bool'): Jobs that are in
|
||||
the build queue. (default False)
|
||||
|
||||
* **columns** (`list`): List of columns to be shown in view.
|
||||
* **regex** (`str`): . Regular expression for selecting jobs
|
||||
(optional)
|
||||
@ -238,6 +249,21 @@ class List(jenkins_jobs.modules.base.Base):
|
||||
convert_mapping_to_xml(fb_xml, fb_data, mapping,
|
||||
fail_required=True)
|
||||
|
||||
if jobfilter == 'build-status':
|
||||
bs_xml = XML.SubElement(job_filter_xml,
|
||||
'hudson.views.BuildStatusFilter')
|
||||
bs_xml.set('plugin', 'view-job-filters')
|
||||
bs_data = jobfilters.get('build-status')
|
||||
mapping = [
|
||||
('match-type', 'includeExcludeTypeString',
|
||||
'includeMatched'),
|
||||
('never-built', 'neverBuilt', False),
|
||||
('building', 'building', False),
|
||||
('in-build-queue', 'inBuildQueue', False),
|
||||
]
|
||||
convert_mapping_to_xml(bs_xml, bs_data, mapping,
|
||||
fail_required=True)
|
||||
|
||||
c_xml = XML.SubElement(root, 'columns')
|
||||
columns = data.get('columns', DEFAULT_COLUMNS)
|
||||
|
||||
|
30
tests/views/fixtures/view_list_build_status_full.xml
Normal file
30
tests/views/fixtures/view_list_build_status_full.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<?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.BuildStatusFilter plugin="view-job-filters">
|
||||
<includeExcludeTypeString>includeMatched</includeExcludeTypeString>
|
||||
<neverBuilt>true</neverBuilt>
|
||||
<building>true</building>
|
||||
<inBuildQueue>true</inBuildQueue>
|
||||
</hudson.views.BuildStatusFilter>
|
||||
</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>
|
13
tests/views/fixtures/view_list_build_status_full.yaml
Normal file
13
tests/views/fixtures/view_list_build_status_full.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
name: list-view-name01
|
||||
view-type: list
|
||||
description: 'Sample description'
|
||||
filter-executors: true
|
||||
filter-queue: true
|
||||
job-filters:
|
||||
build-status:
|
||||
match-type: includeMatched
|
||||
never-built: true
|
||||
building: true
|
||||
in-build-queue: true
|
||||
recurse: true
|
||||
status-filter: false
|
30
tests/views/fixtures/view_list_build_status_min.xml
Normal file
30
tests/views/fixtures/view_list_build_status_min.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<?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.BuildStatusFilter plugin="view-job-filters">
|
||||
<includeExcludeTypeString>includeMatched</includeExcludeTypeString>
|
||||
<neverBuilt>false</neverBuilt>
|
||||
<building>false</building>
|
||||
<inBuildQueue>false</inBuildQueue>
|
||||
</hudson.views.BuildStatusFilter>
|
||||
</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_build_status_min.yaml
Normal file
10
tests/views/fixtures/view_list_build_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:
|
||||
build-status:
|
||||
match-type: includeMatched
|
||||
recurse: true
|
||||
status-filter: false
|
Loading…
x
Reference in New Issue
Block a user