Merge "Refactor the common-view and csit-view template"
authorAnil Belur <abelur@linuxfoundation.org>
Thu, 8 Nov 2018 03:50:36 +0000 (03:50 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Thu, 8 Nov 2018 03:50:36 +0000 (03:50 +0000)
14 files changed:
.jjb-test/defaults.yaml
.jjb-test/lf-ci-jobs.yaml
.jjb-test/lf-ci-jobs/jenkins-cfg-merge-minimal.yaml
.jjb-test/lf-common-view.yaml [new file with mode: 0644]
.jjb-test/lf-csit-view.yaml [new file with mode: 0644]
.jjb-test/lf-maven-jobs.yaml
.jjb-test/lf-node-jobs.yaml
.jjb-test/lf-openstack.yaml
.jjb-test/lf-project-view.yaml [new file with mode: 0644]
.jjb-test/lf-python-jobs.yaml
.jjb-test/lf-rtd-jobs.yaml
docs/jjb/lf-views.rst
jjb/lf-views.yaml
releasenotes/notes/lf-view-templates-add-64911f643dc053d8.yaml

index 75b5061..4a7a3bb 100644 (file)
@@ -27,6 +27,3 @@
     project: releng/ciman
     stream: latest
     build-node: build-vm
-
-    view-regex: '{project-name}-.*'
-    view-description: 'List of {project-name} jobs'
index 63f94bf..d80ae61 100644 (file)
@@ -62,8 +62,7 @@
 
 - project:
     name: ci-jobs-view
-    project-name: ci-jobs
     views:
-      - common-view
-    view-regex: '.*-ci-jobs$|.*-openstack-jobs$|.*-packer-jobs$'
-    view-description: 'List of ci-jobs, openstack and packer jobs'
+      - project-view
+
+    project-name: ci-jobs
index 83a4d49..5b7173e 100644 (file)
@@ -5,11 +5,3 @@
       - 'gerrit-jenkins-cfg-merge'
 
     project-name: ci-management
-
-- project:
-    name: jenkins-cfg-jobs-view
-    project-name: jenkins-cfg
-    views:
-      - common-view
-    view-regex: '^jenkins-cfg.*'
-    view-description: 'List of jenkins-cfg jobs'
diff --git a/.jjb-test/lf-common-view.yaml b/.jjb-test/lf-common-view.yaml
new file mode 100644 (file)
index 0000000..240edee
--- /dev/null
@@ -0,0 +1,8 @@
+---
+- project:
+    name: common-view-test
+    views:
+      - common-view
+
+    view-name: Daily
+    view-regex: '.*-daily-.*'
diff --git a/.jjb-test/lf-csit-view.yaml b/.jjb-test/lf-csit-view.yaml
new file mode 100644 (file)
index 0000000..b01bf79
--- /dev/null
@@ -0,0 +1,8 @@
+---
+- project:
+    name: csit-view-test
+    views:
+      - csit-view
+
+    view-name: CSIT-1node
+    view-regex: '.*csit-1node.*'
index 98b26e5..03c722b 100644 (file)
@@ -38,8 +38,7 @@
 
 - project:
     name: maven-jobs-view
-    project-name: maven
     views:
-      - common-view
-    view-regex: '.*-maven$'
-    view-description: 'List of maven jobs'
+      - project-view
+
+    project-name: maven
index ed40279..274a7f0 100644 (file)
@@ -15,8 +15,7 @@
 
 - project:
     name: node-jobs-view
-    project-name: node
     views:
-      - common-view
-    view-regex: '.*-node$'
-    view-description: 'List of node jobs'
+      - project-view
+
+    project-name: node
index 12f55e8..a8780f8 100644 (file)
@@ -10,8 +10,7 @@
 
 - project:
     name: openstack-jobs-view
-    project-name: openstack
     views:
-      - common-view
-    view-regex: '.*-openstack$'
-    view-description: 'List of openstack jobs'
+      - project-view
+
+    project-name: openstack
diff --git a/.jjb-test/lf-project-view.yaml b/.jjb-test/lf-project-view.yaml
new file mode 100644 (file)
index 0000000..aabc681
--- /dev/null
@@ -0,0 +1,7 @@
+---
+- project:
+    name: project-view-test
+    views:
+      - project-view
+
+    project-name: project-view-test
index 9961935..6a10b8f 100644 (file)
@@ -17,8 +17,7 @@
 
 - project:
     name: python-jobs-view
-    project-name: python
     views:
-      - common-view
-    view-regex: '.*-python$'
-    view-description: 'List of Python jobs'
+      - project-view
+
+    project-name: python
index 975c47a..a530d4a 100644 (file)
@@ -21,8 +21,7 @@
 
 - project:
     name: rtd-jobs-view
-    project-name: rtd
     views:
-      - common-view
-    view-regex: '.*-rtd$'
-    view-description: 'List of rtd jobs'
+      - project-view
+
+    project-name: rtd
index 926ba59..7ed4936 100644 (file)
@@ -7,14 +7,59 @@ Jenkins Views
 View Templates
 ==============
 
-JJB view-templates provides a way to manage Jenkins views through code.
+JJB view-templates provides a way to manage Jenkins views through code. Using
+view-templates we can define common views configuration that are interesting
+to a project.
 
+We recommend creating separate project sections for views apart from job
+configuration such that job configuration does not overlap with the view
+configuration.
+
+Example Usage:
+
+.. code-block:: yaml
+
+   ---
+   - project:
+       name: project-view
+       views:
+         - common-view
+
+       project-name: project
+
+   - project:
+       name: project-stream1
+       jobs:
+         - '{project-name}-{seq}'
+
+       project: project
+       project-name: project
+       seq:
+         - a
+         - b
+
+   - project:
+       name: project-stream2
+       jobs:
+         - '{project-name}-{seq}'
+
+       project: project
+       project-name: project
+       seq:
+         - x
+         - y
+
+   - job-template:
+       name: '{project-name}-{seq}'
 
-Common view
------------
 
-Common view groups jobs related to a project and supports the following
-columns.
+Project view
+------------
+
+Groups all jobs owned by a project under one view by capturing jobs with the
+prefix of ``project-name``.
+
+This view uses the following columns:
 
 :Columns:
 
@@ -27,20 +72,15 @@ columns.
     - build-button
     - jacoco
     - find-bugs
-    - robot-list
 
 :Template Names:
 
-    - common-view
     - {project-name}
+    - project-view
 
 :Required parameters:
 
-    :project-name: The name of the view.
-    :view-description: View description. (Generally set to 'List of
-        {project-name} jobs' in defaults.yaml)
-    :view-regex: Regex to match the jobs. (Generally set to '^{project-name}-.*'
-        in defaults.yaml)
+    :project-name: The name of the project utilizing the view.
 
 :Optional parameters:
 
@@ -48,11 +88,60 @@ columns.
     :view-filter-queue: View filter queue. (default: false)
     :view-recurse: View recurse. (default: false)
 
-Integration CSIT view
----------------------
+Example:
+
+.. literalinclude:: ../../.jjb-test/lf-project-view.yaml
+   :language: yaml
+
 
-Integration CSIT view provides a view for integration or CSIT jobs.
-The view supports the following set of columns.
+Common view
+-----------
+
+Groups all jobs owned by a project under one view by capturing jobs with the
+prefix of ``project-name``.
+
+This view uses the following columns:
+
+:Columns:
+
+   - status
+   - weather
+   - job
+   - last-success
+   - last-failure
+   - last-duration
+   - build-button
+   - jacoco
+   - find-bugs
+
+:Template Names:
+
+   - {view-name}
+   - common-view
+
+:Required parameters:
+
+   :view-name: The name of the view.
+   :view-regex: Regex to match the jobs.
+
+:Optional parameters:
+
+   :view-filter-executors: View filter executor. (default: false)
+   :view-filter-queue: View filter queue. (default: false)
+   :view-recurse: View recurse. (default: false)
+
+Example:
+
+.. literalinclude:: ../../.jjb-test/lf-common-view.yaml
+  :language: yaml
+
+
+CSIT view template
+------------------
+
+View template that loads columns useful for CSIT jobs.
+
+This view uses the following columns:
 
 :Columns:
 
@@ -67,19 +156,22 @@ The view supports the following set of columns.
 
 :Template Names:
 
-    - integration-csit-view
-    - {project-name}
+    - {view-name}
+    - csit-view
 
 :Required parameters:
 
-    :project-name: The name of the view.
-    :view-description: View description. (Generally set to 'List of
-        {project-name} jobs' in defaults.yaml)
-    :view-regex: Regex to match the jobs. (Generally set to '^{project-name}-.*'
-        in defaults.yaml)
+    :view-name: The name of the view.
+    :view-regex: Regex to match the jobs.
 
 :Optional parameters:
 
+    :view-description: View description. (default: 'CSIT Jobs.')
     :view-filter-executors: View filter executor. (default: false)
     :view-filter-queue: View filter queue. (default: false)
     :view-recurse: View recurse. (default: false)
+
+Example:
+
+.. literalinclude:: ../../.jjb-test/lf-csit-view.yaml
+   :language: yaml
index b1777af..a8ff34b 100644 (file)
@@ -3,14 +3,29 @@
 # common view template #
 ########################
 
+- lf_view_common_columns: &lf_view_common_columns
+    name: lf-view-common-columns
+
+    columns:
+      - status
+      - weather
+      - job
+      - last-success
+      - last-failure
+      - last-duration
+      - build-button
+      - jacoco
+      - find-bugs
+
 - view-template:
     id: 'common-view'
-    name: '{project-name}'
+    name: '{view-name}'
 
     ######################
     # Default parameters #
     ######################
 
+    view-description: 'View using common-view template.'
     view-filter-executors: false
     view-filter-queue: false
     view-recurse: false
     ######################
 
     view-type: list
+    description: '{view-description}'
     filter-executors: '{view-filter-executors}'
     filter-queue: '{view-filter-queue}'
-    columns:
-      - status
-      - weather
-      - job
-      - last-success
-      - last-failure
-      - last-duration
-      - build-button
-      - jacoco
-      - find-bugs
-      - robot-list
     recurse: '{view-recurse}'
     regex: '{view-regex}'
-    description: '{view-description}'
+    <<: *lf_view_common_columns
 
-#############################
-# integration view template #
-#############################
+######################
+# CSIT view template #
+######################
 
 - view-template:
-    id: 'integration-csit-view'
-    name: '{project-name}'
+    id: 'csit-view'
+    name: '{view-name}'
 
     ######################
     # Default parameters #
     ######################
 
+    view-description: 'CSIT jobs.'
     view-filter-executors: false
     view-filter-queue: false
     view-recurse: false
     ######################
 
     view-type: list
+    description: '{view-description}'
     filter-executors: '{view-filter-executors}'
     filter-queue: '{view-filter-queue}'
+    recurse: '{view-recurse}'
+    regex: '{view-regex}'
     columns:
       - status
       - weather
       - last-duration
       - build-button
       - robot-list
+
+#########################
+# project view template #
+#########################
+
+- view-template:
+    id: 'project-view'
+    name: '{project-name}'
+
+    ######################
+    # Default parameters #
+    ######################
+
+    view-filter-executors: false
+    view-filter-queue: false
+    view-recurse: false
+
+    ######################
+    # view Configuration #
+    ######################
+
+    view-type: list
+    description: 'List of jobs for {project-name}.'
+    filter-executors: '{view-filter-executors}'
+    filter-queue: '{view-filter-queue}'
     recurse: '{view-recurse}'
-    regex: '{view-regex}'
-    description: '{view-description}'
+    regex: '^{project-name}-.*'
+    <<: *lf_view_common_columns
index d39b80f..ba77bb4 100644 (file)
@@ -1,83 +1,56 @@
 ---
 features:
   - |
-    New view-templates ``common-view`` and ``integration-csit-view`` are
+    New view-templates ``project-view``, ``common-view``, and ``csit-view`` are
     available for projects to manage Jenkins views through code.
 
-    To use the ``common-view`` template in a project.
-
-    Usage:
+    To use the ``project-view`` template in a project:
 
     .. code-block:: yaml
 
        - project:
-           ...
+           name: aaa-view
            views:
-             - common-view
+             - project-view
 
-    To use the ``integration-csit-view`` template in a project.
+           project-name: aaa
 
-    Usage:
+    To use the ``common-view`` template in a project:
 
     .. code-block:: yaml
 
        - project:
-           ...
+           name: daily-builds
            views:
-             - integration-csit-view
+             - common-view
 
-  - |
-    A separate project section can be defined for views that are common to a
-    set of jobs. This creates a list-type view with ``<project-name>`` in
-    Jenkins which lists all the jobs under the view.
+           view-name: Periodic
+           view-regex: '.*-periodic-.*'
 
-    Usage:
+    To use the ``csit-view`` template in a project:
 
     .. code-block:: yaml
 
        - project:
-           name: <project-name-view>
-           project: <project>
-           project-name: <project-name>
+           name: csit
            views:
-             - common-view
-
-    Example Usage:
+             - csit-view
 
-    .. code-block:: yaml
-
-       ---
-       - defaults:
-           name: global
-           view-regex: '^{project-name}-.*'
-           view-description: 'default view description'
+           view-name: CSIT
+           view-regex: '.*csit.*'
 
        - project:
-           name: project-view
-           project: project
-           project-name: project
+           name: csit-1node
            views:
-             - common-view
-
-       - project:
-           name: project-stream1
-           project: project
-           project-name: project
-           jobs:
-             - '{project-name}-{seq}'
-           seq:
-             - a
-             - b
+             - csit-view
 
-       - project:
-           name: project-stream2
-           project: project
-           project-name: project
-           jobs:
-             - '{project-name}-{seq}'
-           seq:
-             - x
-             - y
+           view-name: CSIT-1node
+           view-regex: '.*-csit-1node-.*'
 
-       - job-template:
-           name: '{project-name}-{seq}'
+upgrade:
+  - |
+    Some LF projects are already using a ``common-view`` template in their
+    local ci-management repo. This ``common-view`` is called ``project-view``
+    in global-jjb so rename all instances of ``common-view`` to
+    ``project-view`` when upgrading and remove the local ``common-view``
+    view-template definition from ci-management.