Add support for user relevance job filter
Add support for user relevance job filter for views. Change-Id: If20378e886c50f799f91e44d02d7d4e2edc9401c Signed-off-by: Anil Belur <askb23@gmail.com>
This commit is contained in:
parent
84940bb38d
commit
565c5a1241
@ -97,6 +97,33 @@ to the :ref:`view_list` definition.
|
||||
* **in-build-queue** ('bool'): Jobs that are in
|
||||
the build queue. (default False)
|
||||
|
||||
* **user-relevence** (`dict`)
|
||||
:user-relevence:
|
||||
* **match-type** ('str'): Jobs that match a filter
|
||||
to include. (default includeMatched)
|
||||
* **build-count** ('str'): Count of builds.
|
||||
(default AtLeastOne)
|
||||
* **amount-type**: ('str'): Duration in hours,
|
||||
days or builds. (default Hours)
|
||||
* **amount**: ('int'): How far back to check.
|
||||
(default 0)
|
||||
* **match-user-id** ('bool'): Jobs matching
|
||||
user-id. (default False)
|
||||
* **match-user-fullname** ('bool'): Jobs
|
||||
matching user fullname. (default False)
|
||||
* **ignore-case** ('bool'): Ignore case.
|
||||
(default False)
|
||||
* **ignore-whitespace** ('bool'): Ignore
|
||||
whitespace. (default False)
|
||||
* **ignore-non-alphaNumeric** ('bool'): Ignore
|
||||
non-alphaNumeric. (default False)
|
||||
* **match-builder** ('bool'): Jobs matching
|
||||
builder. (default False)
|
||||
* **match-email** ('bool'): Jobs matching
|
||||
email. (default False)
|
||||
* **match-scm-changes** ('bool'): Jobs matching
|
||||
scm changes. (default False)
|
||||
|
||||
* **columns** (`list`): List of columns to be shown in view.
|
||||
* **regex** (`str`): . Regular expression for selecting jobs
|
||||
(optional)
|
||||
@ -264,6 +291,30 @@ class List(jenkins_jobs.modules.base.Base):
|
||||
convert_mapping_to_xml(bs_xml, bs_data, mapping,
|
||||
fail_required=True)
|
||||
|
||||
if jobfilter == 'user-relevence':
|
||||
ur_xml = XML.SubElement(job_filter_xml,
|
||||
'hudson.views.UserRelevanceFilter')
|
||||
ur_xml.set('plugin', 'view-job-filters')
|
||||
ur_data = jobfilters.get('user-relevence')
|
||||
mapping = [
|
||||
('match-type', 'includeExcludeTypeString',
|
||||
'includeMatched'),
|
||||
('build-count', 'buildCountTypeString', 'AtLeastOne'),
|
||||
('amount-type', 'amountTypeString', 'Hours'),
|
||||
('amount', 'amount', '0'),
|
||||
('match-user-id', 'matchUserId', False),
|
||||
('match-user-fullname', 'matchUserFullName', False),
|
||||
('ignore-case', 'ignoreCase', False),
|
||||
('ignore-whitespace', 'ignoreWhitespace', False),
|
||||
('ignore-non-alphaNumeric', 'ignoreNonAlphaNumeric',
|
||||
False),
|
||||
('match-builder', 'matchBuilder', False),
|
||||
('match-email', 'matchEmail', False),
|
||||
('match-scm-changes', 'matchScmChanges', False),
|
||||
]
|
||||
convert_mapping_to_xml(ur_xml, ur_data, mapping,
|
||||
fail_required=True)
|
||||
|
||||
c_xml = XML.SubElement(root, 'columns')
|
||||
columns = data.get('columns', DEFAULT_COLUMNS)
|
||||
|
||||
|
38
tests/views/fixtures/view_list_userrelevence_filter_full.xml
Normal file
38
tests/views/fixtures/view_list_userrelevence_filter_full.xml
Normal file
@ -0,0 +1,38 @@
|
||||
<?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.UserRelevanceFilter plugin="view-job-filters">
|
||||
<includeExcludeTypeString>includeMatched</includeExcludeTypeString>
|
||||
<buildCountTypeString>AtLeastOne</buildCountTypeString>
|
||||
<amountTypeString>Hours</amountTypeString>
|
||||
<amount>1.0</amount>
|
||||
<matchUserId>true</matchUserId>
|
||||
<matchUserFullName>true</matchUserFullName>
|
||||
<ignoreCase>true</ignoreCase>
|
||||
<ignoreWhitespace>true</ignoreWhitespace>
|
||||
<ignoreNonAlphaNumeric>true</ignoreNonAlphaNumeric>
|
||||
<matchBuilder>true</matchBuilder>
|
||||
<matchEmail>true</matchEmail>
|
||||
<matchScmChanges>true</matchScmChanges>
|
||||
</hudson.views.UserRelevanceFilter>
|
||||
</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>
|
@ -0,0 +1,21 @@
|
||||
name: list-view-name01
|
||||
view-type: list
|
||||
description: 'Sample description'
|
||||
filter-executors: true
|
||||
filter-queue: true
|
||||
job-filters:
|
||||
user-relevence:
|
||||
match-type: includeMatched
|
||||
build-count: AtLeastOne
|
||||
mount-type: Hours
|
||||
amount: 1.0
|
||||
match-user-id: true
|
||||
match-user-fullname: true
|
||||
ignore-case: true
|
||||
ignore-whitespace: true
|
||||
ignore-non-alphaNumeric: true
|
||||
match-builder: true
|
||||
match-email: true
|
||||
match-scm-changes: true
|
||||
recurse: true
|
||||
status-filter: false
|
38
tests/views/fixtures/view_list_userrelevence_filter_min.xml
Normal file
38
tests/views/fixtures/view_list_userrelevence_filter_min.xml
Normal file
@ -0,0 +1,38 @@
|
||||
<?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.UserRelevanceFilter plugin="view-job-filters">
|
||||
<includeExcludeTypeString>includeMatched</includeExcludeTypeString>
|
||||
<buildCountTypeString>AtLeastOne</buildCountTypeString>
|
||||
<amountTypeString>Hours</amountTypeString>
|
||||
<amount>0</amount>
|
||||
<matchUserId>false</matchUserId>
|
||||
<matchUserFullName>false</matchUserFullName>
|
||||
<ignoreCase>false</ignoreCase>
|
||||
<ignoreWhitespace>false</ignoreWhitespace>
|
||||
<ignoreNonAlphaNumeric>false</ignoreNonAlphaNumeric>
|
||||
<matchBuilder>false</matchBuilder>
|
||||
<matchEmail>false</matchEmail>
|
||||
<matchScmChanges>false</matchScmChanges>
|
||||
</hudson.views.UserRelevanceFilter>
|
||||
</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_userrelevence_filter_min.yaml
Normal file
10
tests/views/fixtures/view_list_userrelevence_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:
|
||||
user-relevence:
|
||||
match-type: includeMatched
|
||||
recurse: true
|
||||
status-filter: false
|
Loading…
Reference in New Issue
Block a user