Add support for parameter job filter
Add support for parameter job filter for views. Change-Id: I55cbfe318a99a8a2bcf9ac2abae5d230272da024 Signed-off-by: Anil Belur <askb23@gmail.com>
This commit is contained in:
parent
e585287380
commit
d9f88828ad
|
@ -139,6 +139,22 @@ to the :ref:`view_list` definition.
|
|||
* **job-type** ('str'): Type of Job.
|
||||
(default hudson.model.FreeStyleProject)
|
||||
|
||||
* **parameter** (`dict`)
|
||||
:parameter:
|
||||
* **match-type** ('str'): Jobs that match a filter to include.
|
||||
(default includeMatched)
|
||||
* **name** ('str'): Job name to match. (default '')
|
||||
* **value** ('str'): Value to match. (default '')
|
||||
* **desc** ('str'): Description to match. (default '')
|
||||
* **use-default-value** ('bool'): Use default value.
|
||||
(default False)
|
||||
* **match-builds-in-progress** ('bool'): Match build in
|
||||
progress. (default False)
|
||||
* **match-all-builds** ('bool'): Match all builds.
|
||||
(default False)
|
||||
* **max-builds-to-match** ('int'): Maximum builds to match.
|
||||
(default 0)
|
||||
|
||||
* **columns** (`list`): List of columns to be shown in view.
|
||||
* **regex** (`str`): . Regular expression for selecting jobs
|
||||
(optional)
|
||||
|
@ -357,6 +373,26 @@ class List(jenkins_jobs.modules.base.Base):
|
|||
convert_mapping_to_xml(jt_xml, jt_data, mapping,
|
||||
fail_required=True)
|
||||
|
||||
if jobfilter == 'parameter':
|
||||
pr_xml = XML.SubElement(job_filter_xml,
|
||||
'hudson.views.ParameterFilter')
|
||||
pr_xml.set('plugin', 'view-job-filters')
|
||||
pr_data = jobfilters.get('parameter')
|
||||
mapping = [
|
||||
('match-type', 'includeExcludeTypeString',
|
||||
'includeMatched'),
|
||||
('name', 'nameRegex', ''),
|
||||
('value', 'valueRegex', ''),
|
||||
('description', 'descriptionRegex', ''),
|
||||
('use-default', 'useDefaultValue', False),
|
||||
('match-builds-in-progress', 'matchBuildsInProgress',
|
||||
False),
|
||||
('match-all-builds', 'matchAllBuilds', False),
|
||||
('max-builds-to-match', 'maxBuildsToMatch', 0),
|
||||
]
|
||||
convert_mapping_to_xml(pr_xml, pr_data, mapping,
|
||||
fail_required=True)
|
||||
|
||||
c_xml = XML.SubElement(root, 'columns')
|
||||
columns = data.get('columns', DEFAULT_COLUMNS)
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<?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.ParameterFilter plugin="view-job-filters">
|
||||
<includeExcludeTypeString>includeMatched</includeExcludeTypeString>
|
||||
<nameRegex>test</nameRegex>
|
||||
<valueRegex>test*</valueRegex>
|
||||
<descriptionRegex>test jobs</descriptionRegex>
|
||||
<useDefaultValue>true</useDefaultValue>
|
||||
<matchBuildsInProgress>true</matchBuildsInProgress>
|
||||
<matchAllBuilds>true</matchAllBuilds>
|
||||
<maxBuildsToMatch>0</maxBuildsToMatch>
|
||||
</hudson.views.ParameterFilter>
|
||||
</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,17 @@
|
|||
name: list-view-name01
|
||||
view-type: list
|
||||
description: 'Sample description'
|
||||
filter-executors: true
|
||||
filter-queue: true
|
||||
job-filters:
|
||||
parameter:
|
||||
match-type: includeMatched
|
||||
name: test
|
||||
value: test*
|
||||
description: test jobs
|
||||
use-default: true
|
||||
match-builds-in-progress: true
|
||||
match-all-builds: true
|
||||
max-builds-to-match: 0
|
||||
recurse: true
|
||||
status-filter: false
|
|
@ -0,0 +1,34 @@
|
|||
<?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.ParameterFilter plugin="view-job-filters">
|
||||
<includeExcludeTypeString>includeMatched</includeExcludeTypeString>
|
||||
<nameRegex>test</nameRegex>
|
||||
<valueRegex/>
|
||||
<descriptionRegex/>
|
||||
<useDefaultValue>false</useDefaultValue>
|
||||
<matchBuildsInProgress>false</matchBuildsInProgress>
|
||||
<matchAllBuilds>false</matchAllBuilds>
|
||||
<maxBuildsToMatch>0</maxBuildsToMatch>
|
||||
</hudson.views.ParameterFilter>
|
||||
</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,11 @@
|
|||
name: list-view-name01
|
||||
view-type: list
|
||||
description: 'Sample description'
|
||||
filter-executors: true
|
||||
filter-queue: true
|
||||
job-filters:
|
||||
parameter:
|
||||
match-type: includeMatched
|
||||
name: 'test'
|
||||
recurse: true
|
||||
status-filter: false
|
Loading…
Reference in New Issue