summaryrefslogtreecommitdiffstats
path: root/jenkins_jobs/modules/view_list.py
diff options
context:
space:
mode:
authorAnil Belur <askb23@gmail.com>2018-03-11 13:53:54 +1000
committerSorin Sbarnea <ssbarnea@redhat.com>2018-04-18 23:32:25 +0100
commite585287380de06b58fd49cea17ee0425b93ad9f3 (patch)
tree5276212a41fc84ebec7e784f98a3b38751d8e190 /jenkins_jobs/modules/view_list.py
parent0361d56fdf6adfdc27249c1ba698e0bf3bdb9096 (diff)
downloadpython-jenkins-job-builder-e585287380de06b58fd49cea17ee0425b93ad9f3.tar.gz
python-jenkins-job-builder-e585287380de06b58fd49cea17ee0425b93ad9f3.tar.xz
python-jenkins-job-builder-e585287380de06b58fd49cea17ee0425b93ad9f3.zip
Add support for job type filter
Add support for job type filter for views. Change-Id: I6bf6af70310d4a0e590187fca3e6db6a52c4ec33 Signed-off-by: Anil Belur <askb23@gmail.com>
Diffstat (limited to 'jenkins_jobs/modules/view_list.py')
-rw-r--r--jenkins_jobs/modules/view_list.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/jenkins_jobs/modules/view_list.py b/jenkins_jobs/modules/view_list.py
index ea97b762..2655cedd 100644
--- a/jenkins_jobs/modules/view_list.py
+++ b/jenkins_jobs/modules/view_list.py
@@ -132,6 +132,13 @@ to the :ref:`view_list` definition.
(default '')
* **regex** ('str'): Regular expression. (default '')
+ * **job-tpye** (`dict`)
+ :job-type:
+ * **match-type** ('str'): Jobs that match a filter to include.
+ (default includeMatched)
+ * **job-type** ('str'): Type of Job.
+ (default hudson.model.FreeStyleProject)
+
* **columns** (`list`): List of columns to be shown in view.
* **regex** (`str`): . Regular expression for selecting jobs
(optional)
@@ -337,6 +344,19 @@ class List(jenkins_jobs.modules.base.Base):
convert_mapping_to_xml(rj_xml, rj_data, mapping,
fail_required=True)
+ if jobfilter == 'job-type':
+ jt_xml = XML.SubElement(job_filter_xml,
+ 'hudson.views.JobTypeFilter')
+ jt_xml.set('plugin', 'view-job-filters')
+ jt_data = jobfilters.get('job-type')
+ mapping = [
+ ('match-type', 'includeExcludeTypeString',
+ 'includeMatched'),
+ ('job-type', 'jobType', 'hudson.model.FreeStyleProject'),
+ ]
+ convert_mapping_to_xml(jt_xml, jt_data, mapping,
+ fail_required=True)
+
c_xml = XML.SubElement(root, 'columns')
columns = data.get('columns', DEFAULT_COLUMNS)