From beed12f3544671271675f8d93017cb69ee6ecf54 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rados=C5=82aw=20Piliszek?= <radoslaw.piliszek@gmail.com>
Date: Sat, 18 Jan 2020 13:01:25 +0100
Subject: [PATCH] CI: Refactor base jobs

Since Zuul was restarted after applying [1], we can keep relevant
files listings in the base jobs per scenario without blocking
periodic job runs.
This greatly simplifies the jobs and project definitions.

[1] https://review.opendev.org/678273

Change-Id: If2e4fff6a514e6174709c2fc9f76b103f81a54ae
---
 zuul.d/base.yaml    | 72 +++++++++++++++++++++++++++++++++++--
 zuul.d/jobs.yaml    | 86 ++++++++++-----------------------------------
 zuul.d/project.yaml | 57 ++++++------------------------
 3 files changed, 97 insertions(+), 118 deletions(-)

diff --git a/zuul.d/base.yaml b/zuul.d/base.yaml
index f053bc7d58..3799e03021 100644
--- a/zuul.d/base.yaml
+++ b/zuul.d/base.yaml
@@ -23,6 +23,7 @@
       - ^specs/
       - ^kolla_ansible/tests/
     vars:
+      previous_release: train
       scenario: core
       is_upgrade: no
       api_network_prefix: "192.0.2."
@@ -34,11 +35,18 @@
       - zuul: zuul/zuul-jobs
 
 - job:
-    name: kolla-ansible-upgrade-base
+    name: kolla-ansible-ceph-base
     parent: kolla-ansible-base
+    voting: false
     vars:
-      previous_release: train
-      is_upgrade: yes
+      scenario: ceph
+    host-vars:
+      primary:
+        ceph_osd_storetype: filestore
+      secondary1:
+        ceph_osd_storetype: bluestore
+      secondary2:
+        ceph_osd_storetype: bluestore
 
 - job:
     name: kolla-ansible-ipv6-base
@@ -53,6 +61,10 @@
 - job:
     name: kolla-ansible-bifrost-base
     parent: kolla-ansible-base
+    voting: false
+    files:
+      - ^ansible/roles/bifrost/
+      - ^tests/test-bifrost.sh
     vars:
       scenario: bifrost
       install_type: source
@@ -98,9 +110,63 @@
     name: kolla-ansible-ceph-ansible-base
     parent: kolla-ansible-base
     voting: false
+    files:
+      - ^ansible/roles/(cinder|glance|gnocchi|nova-cell)/
+      - ^tests/deploy-ceph-ansible.sh
     vars:
       scenario: ceph-ansible
       ceph_osd_storetype: ceph-lvm
     required-projects:
       - name: github.com/ceph/ceph-ansible
         override-checkout: v4.0.7
+
+- job:
+    name: kolla-ansible-cinder-lvm-base
+    parent: kolla-ansible-base
+    voting: false
+    files:
+      - ^ansible/roles/(cinder|iscsi)/
+      - ^tests/setup_disks.sh
+      - ^tests/test-core-openstack.sh
+      - ^tests/test-dashboard.sh
+    vars:
+      scenario: cinder-lvm
+
+- job:
+    name: kolla-ansible-masakari-base
+    parent: kolla-ansible-base
+    voting: false
+    files:
+      - ^ansible/roles/masakari/
+      - ^tests/test-masakari.sh
+      - ^tests/test-dashboard.sh
+    vars:
+      scenario: masakari
+
+- job:
+    name: kolla-ansible-mariadb-base
+    parent: kolla-ansible-base
+    voting: false
+    files:
+      - ^ansible/roles/mariadb/
+      - ^tests/test-mariadb.sh
+    vars:
+      scenario: mariadb
+
+- job:
+    name: kolla-ansible-scenario-nfv-base
+    parent: kolla-ansible-base
+    voting: false
+    files:
+      - ^ansible/roles/(barbican|heat|mistral|redis|tacker)/
+      - ^tests/test-scenario-nfv.sh
+      - ^tests/test-dashboard.sh
+    vars:
+      scenario: scenario_nfv
+
+- job:
+    name: kolla-ansible-cells-base
+    parent: kolla-ansible-base
+    voting: false
+    vars:
+      scenario: cells
diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml
index d1f26e2a54..30662ea004 100644
--- a/zuul.d/jobs.yaml
+++ b/zuul.d/jobs.yaml
@@ -61,39 +61,21 @@
 
 - job:
     name: kolla-ansible-ubuntu-source-ceph
-    parent: kolla-ansible-base
+    parent: kolla-ansible-ceph-base
     nodeset: kolla-ansible-bionic-multi
     timeout: 9000
-    voting: false
     vars:
       base_distro: ubuntu
       install_type: source
-      scenario: ceph
-    host-vars:
-      primary:
-        ceph_osd_storetype: filestore
-      secondary1:
-        ceph_osd_storetype: bluestore
-      secondary2:
-        ceph_osd_storetype: bluestore
 
 - job:
     name: kolla-ansible-centos-source-ceph
-    parent: kolla-ansible-base
+    parent: kolla-ansible-ceph-base
     nodeset: kolla-ansible-centos-multi
     timeout: 9000
-    voting: false
     vars:
       base_distro: centos
       install_type: source
-      scenario: ceph
-    host-vars:
-      primary:
-        ceph_osd_storetype: filestore
-      secondary1:
-        ceph_osd_storetype: bluestore
-      secondary2:
-        ceph_osd_storetype: bluestore
 
 - job:
     name: kolla-ansible-centos-source-ceph-ansible
@@ -115,103 +97,80 @@
 
 - job:
     name: kolla-ansible-ubuntu-source-cinder-lvm
-    parent: kolla-ansible-base
+    parent: kolla-ansible-cinder-lvm-base
     nodeset: kolla-ansible-bionic-multi
-    voting: false
     vars:
       base_distro: ubuntu
       install_type: source
-      scenario: cinder-lvm
 
 - job:
     name: kolla-ansible-centos-source-cinder-lvm
-    parent: kolla-ansible-base
+    parent: kolla-ansible-cinder-lvm-base
     nodeset: kolla-ansible-centos-multi
-    voting: false
     vars:
       base_distro: centos
       install_type: source
-      scenario: cinder-lvm
 
 - job:
     name: kolla-ansible-centos-source-mariadb
-    parent: kolla-ansible-base
+    parent: kolla-ansible-mariadb-base
     nodeset: kolla-ansible-centos-multi
-    voting: false
     vars:
       base_distro: centos
       install_type: source
-      scenario: mariadb
 
 - job:
     name: kolla-ansible-ubuntu-source-mariadb
-    parent: kolla-ansible-base
+    parent: kolla-ansible-mariadb-base
     nodeset: kolla-ansible-bionic-multi
-    voting: false
     vars:
       base_distro: ubuntu
       install_type: source
-      scenario: mariadb
 
 - job:
     name: kolla-ansible-centos-source-upgrade
-    parent: kolla-ansible-upgrade-base
+    parent: kolla-ansible-base
     nodeset: kolla-ansible-centos
     timeout: 9000
     vars:
       base_distro: centos
       install_type: source
+      is_upgrade: yes
 
 - job:
     name: kolla-ansible-ubuntu-source-upgrade
-    parent: kolla-ansible-upgrade-base
+    parent: kolla-ansible-base
     nodeset: kolla-ansible-bionic
     timeout: 9000
     vars:
       base_distro: ubuntu
       install_type: source
+      is_upgrade: yes
 
 - job:
     name: kolla-ansible-ubuntu-source-upgrade-ceph
-    parent: kolla-ansible-upgrade-base
+    parent: kolla-ansible-ceph-base
     nodeset: kolla-ansible-bionic-multi
     timeout: 9000
-    voting: false
     vars:
       base_distro: ubuntu
       install_type: source
-      scenario: ceph
-    host-vars:
-      primary:
-        ceph_osd_storetype: filestore
-      secondary1:
-        ceph_osd_storetype: bluestore
-      secondary2:
-        ceph_osd_storetype: bluestore
+      is_upgrade: yes
 
 - job:
     name: kolla-ansible-centos-source-upgrade-ceph
-    parent: kolla-ansible-upgrade-base
+    parent: kolla-ansible-ceph-base
     nodeset: kolla-ansible-centos-multi
     timeout: 9000
-    voting: false
     vars:
       base_distro: centos
       install_type: source
-      scenario: ceph
-    host-vars:
-      primary:
-        ceph_osd_storetype: filestore
-      secondary1:
-        ceph_osd_storetype: bluestore
-      secondary2:
-        ceph_osd_storetype: bluestore
+      is_upgrade: yes
 
 - job:
     name: kolla-ansible-bifrost-centos-source
     parent: kolla-ansible-bifrost-base
     nodeset: kolla-ansible-centos
-    voting: false
     vars:
       base_distro: centos
 
@@ -249,14 +208,11 @@
 
 - job:
     name: kolla-ansible-centos-source-scenario-nfv
-    parent: kolla-ansible-base
+    parent: kolla-ansible-scenario-nfv-base
     nodeset: kolla-ansible-centos-multi
-    description: CI scenario to test NFV orchestration
-    voting: false
     vars:
       base_distro: centos
       install_type: source
-      scenario: scenario_nfv
 
 - job:
     name: kolla-ansible-centos-source-ironic
@@ -294,30 +250,24 @@
 
 - job:
     name: kolla-ansible-ubuntu-source-masakari
-    parent: kolla-ansible-base
+    parent: kolla-ansible-masakari-base
     nodeset: kolla-ansible-bionic
-    voting: false
     vars:
       base_distro: ubuntu
       install_type: source
-      scenario: masakari
 
 - job:
     name: kolla-ansible-centos-source-masakari
-    parent: kolla-ansible-base
+    parent: kolla-ansible-masakari-base
     nodeset: kolla-ansible-centos
-    voting: false
     vars:
       base_distro: centos
       install_type: source
-      scenario: masakari
 
 - job:
     name: kolla-ansible-centos-source-cells
-    parent: kolla-ansible-base
+    parent: kolla-ansible-cells-base
     nodeset: kolla-ansible-centos-multi
-    voting: false
     vars:
       base_distro: centos
       install_type: source
-      scenario: cells
diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml
index 3c7f166368..b315ba7fb8 100644
--- a/zuul.d/project.yaml
+++ b/zuul.d/project.yaml
@@ -17,41 +17,16 @@
         - kolla-ansible-ubuntu-source-multinode-ipv6
         - kolla-ansible-ubuntu-source-ceph
         - kolla-ansible-centos-source-ceph
-        - kolla-ansible-ubuntu-source-cinder-lvm:
-            files:
-              - ^ansible/roles/(cinder|iscsi)/
-              - ^tests/setup_disks.sh
-              - ^tests/test-core-openstack.sh
-              - ^tests/test-dashboard.sh
-        - kolla-ansible-centos-source-cinder-lvm:
-            files:
-              - ^ansible/roles/(cinder|iscsi)/
-              - ^tests/setup_disks.sh
-              - ^tests/test-core-openstack.sh
-              - ^tests/test-dashboard.sh
-        - kolla-ansible-bifrost-centos-source:
-            files:
-              - ^ansible/roles/bifrost/
-              - ^tests/test-bifrost.sh
+        - kolla-ansible-ubuntu-source-cinder-lvm
+        - kolla-ansible-centos-source-cinder-lvm
+        - kolla-ansible-bifrost-centos-source
         - kolla-ansible-centos-source-zun
         - kolla-ansible-ubuntu-source-zun
         - kolla-ansible-centos-source-swift
         - kolla-ansible-ubuntu-source-swift
-        - kolla-ansible-centos-source-scenario-nfv:
-            files:
-              - ^ansible/roles/(barbican|heat|mistral|redis|tacker)/
-              - ^tests/test-scenario-nfv.sh
-              - ^tests/test-dashboard.sh
-        - kolla-ansible-ubuntu-source-masakari:
-            files:
-              - ^ansible/roles/masakari/
-              - ^tests/test-masakari.sh
-              - ^tests/test-dashboard.sh
-        - kolla-ansible-centos-source-masakari:
-            files:
-              - ^ansible/roles/masakari/
-              - ^tests/test-masakari.sh
-              - ^tests/test-dashboard.sh
+        - kolla-ansible-centos-source-scenario-nfv
+        - kolla-ansible-ubuntu-source-masakari
+        - kolla-ansible-centos-source-masakari
         - kolla-ansible-centos-source-ironic
         - kolla-ansible-centos-binary-ironic
         - kolla-ansible-ubuntu-source-ironic
@@ -62,22 +37,10 @@
         - kolla-ansible-centos-binary
         - kolla-ansible-ubuntu-binary
         - kolla-ansible-centos-source-cells
-        - kolla-ansible-centos-source-mariadb:
-            files:
-              - ^ansible/roles/mariadb/
-              - ^tests/test-mariadb.sh
-        - kolla-ansible-ubuntu-source-mariadb:
-            files:
-              - ^ansible/roles/mariadb/
-              - ^tests/test-mariadb.sh
-        - kolla-ansible-centos-source-ceph-ansible:
-            files:
-              - ^ansible/roles/(cinder|glance|gnocchi|nova-cell)/
-              - ^tests/deploy-ceph-ansible.sh
-        - kolla-ansible-ubuntu-source-ceph-ansible:
-            files:
-              - ^ansible/roles/(cinder|glance|gnocchi|nova-cell)/
-              - ^tests/deploy-ceph-ansible.sh
+        - kolla-ansible-centos-source-mariadb
+        - kolla-ansible-ubuntu-source-mariadb
+        - kolla-ansible-centos-source-ceph-ansible
+        - kolla-ansible-ubuntu-source-ceph-ansible
     check-arm64:
       jobs:
         - kolla-ansible-debian-source-aarch64