diff --git a/jenkins_jobs/modules/view_list.py b/jenkins_jobs/modules/view_list.py index e628b390b..c4ab81dee 100644 --- a/jenkins_jobs/modules/view_list.py +++ b/jenkins_jobs/modules/view_list.py @@ -50,6 +50,8 @@ COLUMN_DICT = { 'build-button': 'hudson.views.BuildButtonColumn', 'last-stable': 'hudson.views.LastStableColumn', } +DEFAULT_COLUMNS = ['status', 'weather', 'job', 'last-success', 'last-failure', + 'last-duration', 'build-button'] class List(jenkins_jobs.modules.base.Base): @@ -78,7 +80,7 @@ class List(jenkins_jobs.modules.base.Base): XML.SubElement(root, 'jobFilters') c_xml = XML.SubElement(root, 'columns') - columns = data.get('columns', []) + columns = data.get('columns', DEFAULT_COLUMNS) for column in columns: if column in COLUMN_DICT: diff --git a/tests/views/fixtures/view_list_defaults001.xml b/tests/views/fixtures/view_list_defaults001.xml new file mode 100644 index 000000000..e5d9b87df --- /dev/null +++ b/tests/views/fixtures/view_list_defaults001.xml @@ -0,0 +1,26 @@ + + + list-view-name01 + Sample description + true + true + + + + job-name-1 + job-name-2 + job-name-3 + + + + + + + + + + + + true + false + diff --git a/tests/views/fixtures/view_list_defaults001.yaml b/tests/views/fixtures/view_list_defaults001.yaml new file mode 100644 index 000000000..a4edd893e --- /dev/null +++ b/tests/views/fixtures/view_list_defaults001.yaml @@ -0,0 +1,11 @@ +name: list-view-name01 +view-type: list +description: 'Sample description' +filter-executors: true +filter-queue: true +job-name: + - job-name-1 + - job-name-2 + - job-name-3 +recurse: true +status-filter: false