From: Thanh Ha Date: Wed, 31 Oct 2018 23:21:18 +0000 (-0400) Subject: Refactor the common-view and csit-view template X-Git-Tag: v0.27.0~9^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F68%2F13268%2F5;p=releng%2Fglobal-jjb.git Refactor the common-view and csit-view template Make the 2 views easier to use by projects. common-view is now project-view, the intent of the project-view is that it automatically matches jobs starting with {project-name} to automatically create a view tab for all of a single project's jobs. The intent of the CSIT view template is to have a common template that loads the most useful columns for CSIT views. Since we do not know the search pattern and view name of these views ahead of time it has 2 required paramaters ``view-name`` and ``view-regex``. There is no need to force configuration in defaults.yaml for these 2 templates. For project-view it's intent is to load all project jobs into a single view using a well known regex which does not need to be modified. For csit-view we don't know how the regex is going to be ahead of time so this view-template should just load the common column configuration and require the view-template user to explicitly declare their regex and view name. Additionally add a new 'common-view' which accepts a view-name and view-regex for users who want to pull in a default view-template for their view. Move documentation from release-notes to documentation. Release notes should be about informing users about new features where detailed documentation should instead to to the documentation of the views. Change-Id: Ife3cfe2e37f019dfb87ac8e90b21afb6bdf06889 Signed-off-by: Thanh Ha --- diff --git a/.jjb-test/defaults.yaml b/.jjb-test/defaults.yaml index 75b5061a..4a7a3bb7 100644 --- a/.jjb-test/defaults.yaml +++ b/.jjb-test/defaults.yaml @@ -27,6 +27,3 @@ project: releng/ciman stream: latest build-node: build-vm - - view-regex: '{project-name}-.*' - view-description: 'List of {project-name} jobs' diff --git a/.jjb-test/lf-ci-jobs.yaml b/.jjb-test/lf-ci-jobs.yaml index 63f94bfe..d80ae610 100644 --- a/.jjb-test/lf-ci-jobs.yaml +++ b/.jjb-test/lf-ci-jobs.yaml @@ -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 diff --git a/.jjb-test/lf-ci-jobs/jenkins-cfg-merge-minimal.yaml b/.jjb-test/lf-ci-jobs/jenkins-cfg-merge-minimal.yaml index 83a4d490..5b7173e8 100644 --- a/.jjb-test/lf-ci-jobs/jenkins-cfg-merge-minimal.yaml +++ b/.jjb-test/lf-ci-jobs/jenkins-cfg-merge-minimal.yaml @@ -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 index 00000000..240edee8 --- /dev/null +++ b/.jjb-test/lf-common-view.yaml @@ -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 index 00000000..b01bf795 --- /dev/null +++ b/.jjb-test/lf-csit-view.yaml @@ -0,0 +1,8 @@ +--- +- project: + name: csit-view-test + views: + - csit-view + + view-name: CSIT-1node + view-regex: '.*csit-1node.*' diff --git a/.jjb-test/lf-maven-jobs.yaml b/.jjb-test/lf-maven-jobs.yaml index 98b26e5e..03c722bd 100644 --- a/.jjb-test/lf-maven-jobs.yaml +++ b/.jjb-test/lf-maven-jobs.yaml @@ -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 diff --git a/.jjb-test/lf-node-jobs.yaml b/.jjb-test/lf-node-jobs.yaml index ed402798..274a7f04 100644 --- a/.jjb-test/lf-node-jobs.yaml +++ b/.jjb-test/lf-node-jobs.yaml @@ -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 diff --git a/.jjb-test/lf-openstack.yaml b/.jjb-test/lf-openstack.yaml index 12f55e8e..a8780f81 100644 --- a/.jjb-test/lf-openstack.yaml +++ b/.jjb-test/lf-openstack.yaml @@ -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 index 00000000..aabc681f --- /dev/null +++ b/.jjb-test/lf-project-view.yaml @@ -0,0 +1,7 @@ +--- +- project: + name: project-view-test + views: + - project-view + + project-name: project-view-test diff --git a/.jjb-test/lf-python-jobs.yaml b/.jjb-test/lf-python-jobs.yaml index 9961935e..6a10b8f5 100644 --- a/.jjb-test/lf-python-jobs.yaml +++ b/.jjb-test/lf-python-jobs.yaml @@ -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 diff --git a/.jjb-test/lf-rtd-jobs.yaml b/.jjb-test/lf-rtd-jobs.yaml index 975c47a9..a530d4a8 100644 --- a/.jjb-test/lf-rtd-jobs.yaml +++ b/.jjb-test/lf-rtd-jobs.yaml @@ -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 diff --git a/docs/jjb/lf-views.rst b/docs/jjb/lf-views.rst index 926ba597..7ed4936c 100644 --- a/docs/jjb/lf-views.rst +++ b/docs/jjb/lf-views.rst @@ -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 diff --git a/jjb/lf-views.yaml b/jjb/lf-views.yaml index b1777af9..a8ff34ba 100644 --- a/jjb/lf-views.yaml +++ b/jjb/lf-views.yaml @@ -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 @@ -20,35 +35,26 @@ ###################### 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 @@ -58,8 +64,11 @@ ###################### 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 @@ -69,6 +78,31 @@ - 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 diff --git a/releasenotes/notes/lf-view-templates-add-64911f643dc053d8.yaml b/releasenotes/notes/lf-view-templates-add-64911f643dc053d8.yaml index d39b80f8..ba77bb4a 100644 --- a/releasenotes/notes/lf-view-templates-add-64911f643dc053d8.yaml +++ b/releasenotes/notes/lf-view-templates-add-64911f643dc053d8.yaml @@ -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 ```` 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: - 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.