Add support for secured jobs filter
Add support for secured jobs filter for views. Change-Id: I8b64d80eb0a6131c188710874c5406a1013e44e6 Signed-off-by: Anil Belur <askb23@gmail.com>
This commit is contained in:
parent
bd07732cc7
commit
f4b66dc531
@ -169,6 +169,11 @@ to the :ref:`view_list` definition.
|
||||
* **scm-type** ('str'): Type of SCM.
|
||||
(default hudson.scm.NullSCM)
|
||||
|
||||
* **secured-job** (`dict`)
|
||||
:secured-job:
|
||||
* **match-type** ('str'): Jobs that match a filter
|
||||
to include. (default includeMatched)
|
||||
|
||||
* **columns** (`list`): List of columns to be shown in view.
|
||||
* **regex** (`str`): . Regular expression for selecting jobs
|
||||
(optional)
|
||||
@ -434,6 +439,18 @@ class List(jenkins_jobs.modules.base.Base):
|
||||
convert_mapping_to_xml(st_xml, st_data, mapping,
|
||||
fail_required=True)
|
||||
|
||||
if jobfilter == 'secured-job':
|
||||
sj_xml = XML.SubElement(job_filter_xml,
|
||||
'hudson.views.SecuredJobsFilter')
|
||||
sj_xml.set('plugin', 'view-job-filters')
|
||||
sj_data = jobfilters.get('secured-job')
|
||||
mapping = [
|
||||
('match-type', 'includeExcludeTypeString',
|
||||
'includeMatched'),
|
||||
]
|
||||
convert_mapping_to_xml(sj_xml, sj_data, mapping,
|
||||
fail_required=True)
|
||||
|
||||
c_xml = XML.SubElement(root, 'columns')
|
||||
columns = data.get('columns', DEFAULT_COLUMNS)
|
||||
|
||||
|
27
tests/views/fixtures/view_list_securedjobs_filter_full.xml
Normal file
27
tests/views/fixtures/view_list_securedjobs_filter_full.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?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.SecuredJobsFilter plugin="view-job-filters">
|
||||
<includeExcludeTypeString>includeMatched</includeExcludeTypeString>
|
||||
</hudson.views.SecuredJobsFilter>
|
||||
</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_securedjobs_filter_full.yaml
Normal file
10
tests/views/fixtures/view_list_securedjobs_filter_full.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:
|
||||
secured-job:
|
||||
match-type: includeMatched
|
||||
recurse: true
|
||||
status-filter: false
|
Loading…
Reference in New Issue
Block a user