metal3: Parameterize version and reorganize projects

By parameterizing the version, it was possible to reduce the number of files since
we used to have one job-template for each version.

Second, the projects.yml is reorganized so that we have projects based
on the different types of tests (e.g. integration and feature) instead
of based on the repository. This is because the test type has more in
common than the repository, so fewer things are duplicated.

Change-Id: I620254144f27861871c5b449afd74e9f1e0dd3a0
diff --git a/jjb/metal3/projects.yml b/jjb/metal3/projects.yml
index 8c79f46..2ba4040 100644
--- a/jjb/metal3/projects.yml
+++ b/jjb/metal3/projects.yml
@@ -52,39 +52,163 @@
     ci_github_repo: 'https://github.com/Nordix/metal3-dev-tools.git'
 
 - project:
-    name: 'project_infra'
-    branch: '${{ghprbActualCommit}}'
-    repo:
-      org: "metal3-io"
-      name: "project-infra"
-    ci_github_repo: '${{ghprbAuthorRepoGitUrl}}'
+    name: integration-tests
+    org: metal3-io
+    proj:
+      - metal3_dev_env:
+          repo: metal3-dev-env
+      - project_infra:
+          repo: project-infra
+          branch: '${{ghprbActualCommit}}'
+          ci_github_repo: '${{ghprbAuthorRepoGitUrl}}'
+      - capm3:
+          repo: cluster-api-provider-metal3
+      - bmo:
+          repo: baremetal-operator
+      - ipam:
+          repo: ip-address-manager
+      - ironic_image:
+          repo: ironic-image
+      - ironic_ipa_downloader:
+          repo: ironic-ipa-downloader
+    image_os:
+      - ubuntu
+      - centos
+    version:
+      - v1b1:
+          capi_version: v1beta1
+          capm3_version: v1beta1
+          target_branches:
+            - 'master'
+            - 'main'
+      - v1a5:
+          capi_version: v1alpha4
+          capm3_version: v1alpha5
+          target_branches:
+            - 'master'
+            - 'main'
+            - 'release-0.5'
+            - 'release-0.1'
+      - v1a4:
+          capi_version: v1alpha3
+          capm3_version: v1alpha4
+          target_branches:
+            - 'master'
+            - 'main'
+            - 'release-0.4'
+            - 'release-0.0'
+    exclude:
+      - proj: ironic_ipa_downloader
+        image_os: centos
+        version: v1a5
+      - proj: ironic_ipa_downloader
+        image_os: centos
+        version: v1a4
     jobs:
-    - capm3_v1a4_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1a5_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1b1_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - feature_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - feature_tests_upgrade_ubuntu
-    - bml_integration_tests_centos
-    - keep_v1b1_test_alive:
-        image_os:
-          - ubuntu
-          - centos
-    - keep_v1a5_test_alive:
-        image_os:
-          - ubuntu
-          - centos
+      - integration_tests
+
+- project:
+    name: keep-integration-tests-alive
+    org: metal3-io
+    proj:
+      - metal3_dev_env:
+          repo: metal3-dev-env
+      - project_infra:
+          repo: project-infra
+          branch: '${{ghprbActualCommit}}'
+          ci_github_repo: '${{ghprbAuthorRepoGitUrl}}'
+      - capm3:
+          repo: cluster-api-provider-metal3
+      - bmo:
+          repo: baremetal-operator
+      - ipam:
+          repo: ip-address-manager
+      - ironic_image:
+          repo: ironic-image
+    image_os:
+      - ubuntu
+      - centos
+    version:
+      - v1b1:
+          capi_version: v1beta1
+          capm3_version: v1beta1
+          target_branches:
+            - 'master'
+            - 'main'
+      - v1a5:
+          capi_version: v1alpha4
+          capm3_version: v1alpha5
+          target_branches:
+            - 'master'
+            - 'main'
+            - 'release-0.5'
+            - 'release-0.1'
+    jobs:
+      - keep_integration_tests
+
+- project:
+    name: feature-tests
+    org: metal3-io
+    proj:
+      - metal3_dev_env:
+          repo: metal3-dev-env
+      - project_infra:
+          repo: project-infra
+          branch: '${{ghprbActualCommit}}'
+          ci_github_repo: '${{ghprbAuthorRepoGitUrl}}'
+      - bmo:
+          repo: baremetal-operator
+    image_os:
+      - ubuntu
+      - centos
+    exclude:
+      - proj: bmo
+        image_os: centos
+    jobs:
+      - feature_tests
+      - feature_tests_upgrade:
+          exclude:
+            - image_os: centos
+            - proj: bmo
+
+- project:
+    name: metal3-dev-env-main-tests
+    org: metal3-io
+    repo: metal3-dev-env
+    image_os:
+      - ubuntu
+      - centos
+    jobs:
+      - main_feature_tests
+      - main_feature_tests_upgrade:
+          exclude:
+            - image_os: centos
+      - capm3_main_integration_tests:
+          version:
+            - v1b1:
+                capi_version: v1beta1
+                capm3_version: v1beta1
+                schedule: "H 4 * * *"
+            - v1a5:
+                capi_version: v1alpha4
+                capm3_version: v1alpha5
+                schedule: "30 4 * * *"
+
+- project:
+    name: bml-tests
+    org: metal3-io
+    image_os: centos
+    jobs:
+      - bml_integration_tests:
+          proj:
+            - metal3_dev_env:
+                repo: metal3-dev-env
+            - project_infra:
+                repo: project-infra
+                branch: '${{ghprbActualCommit}}'
+                ci_github_repo: '${{ghprbAuthorRepoGitUrl}}'
+      - bml_main_integration_tests:
+          repo: metal3-dev-env
 
 - project:
     name: 'project_infra_cleanup'
@@ -96,191 +220,41 @@
     - main_clean
 
 - project:
-    name: "bmo"
-    repo:
-      org: "metal3-io"
-      name: "baremetal-operator"
-    jobs:
-    - capm3_v1a4_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1a5_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1b1_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - keep_v1b1_test_alive:
-        image_os:
-          - ubuntu
-          - centos
-    - keep_v1a5_test_alive:
-        image_os:
-          - ubuntu
-          - centos
-    - feature_tests:
-        image_os: ubuntu
-
-- project:
-    name: "ipam"
-    repo:
-      org: "metal3-io"
-      name: "ip-address-manager"
-    jobs:
-    - capm3_v1a4_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1a5_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1b1_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - keep_v1b1_test_alive:
-        image_os:
-          - ubuntu
-          - centos
-    - keep_v1a5_test_alive:
-        image_os:
-          - ubuntu
-          - centos
-
-- project:
-    name: "metal3_dev_env"
-    repo:
-      org: "metal3-io"
-      name: "metal3-dev-env"
-    jobs:
-    - capm3_v1a4_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1a5_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1a5_main_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1b1_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1b1_main_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - feature_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - feature_tests_upgrade_ubuntu
-    - main_feature_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - main_feature_tests_upgrade_ubuntu
-    - bml_integration_tests_centos
-    - bml_main_integration_tests_centos
-    - keep_v1b1_test_alive:
-        image_os:
-          - ubuntu
-          - centos
-    - keep_v1a5_test_alive:
-        image_os:
-          - ubuntu
-          - centos
-
-- project:
     name: "capm3"
     repo:
       org: "metal3-io"
       name: "cluster-api-provider-metal3"
+    image_os:
+      - ubuntu
+      - centos
     jobs:
-    - capm3_v1a4_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1a5_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1a5_e2e_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1a5_main_e2e_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1b1_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1b1_e2e_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1b1_e2e_upgrade_tests_ubuntu
-    - capm3_v1b1_main_e2e_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - keep_v1b1_test_alive:
-        image_os:
-          - ubuntu
-          - centos
-    - keep_v1a5_test_alive:
-        image_os:
-          - ubuntu
-          - centos
-
-
-- project:
-    name: "ironic_image"
-    repo:
-      org: "metal3-io"
-      name: "ironic-image"
-    jobs:
-    - capm3_v1a4_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1a5_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - capm3_v1b1_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
-    - keep_v1b1_test_alive:
-        image_os:
-          - ubuntu
-          - centos
-    - keep_v1a5_test_alive:
-        image_os:
-          - ubuntu
-          - centos
-
-- project:
-    name: "ironic_ipa_downloader"
-    repo:
-      org: "metal3-io"
-      name: "ironic-ipa-downloader"
-    jobs:
-    - capm3_v1a4_integration_tests:
-        image_os: ubuntu
-    - capm3_v1a5_integration_tests:
-        image_os: ubuntu
-    - capm3_v1b1_integration_tests:
-        image_os:
-          - ubuntu
-          - centos
+      - capm3_e2e_upgrade_tests:
+          exclude:
+            - image_os: centos
+      - capm3_e2e_tests:
+          version:
+            - v1b1:
+                capi_version: v1beta1
+                capm3_version: v1beta1
+                target_branches:
+                  - 'master'
+                  - 'main'
+            - v1a5:
+                capi_version: v1alpha4
+                capm3_version: v1alpha5
+                target_branches:
+                  - 'master'
+                  - 'main'
+                  - 'release-0.5'
+      - capm3_main_e2e_tests:
+          version:
+            - v1b1:
+                capi_version: v1beta1
+                capm3_version: v1beta1
+                capm3_branch: main
+                schedule: "H 20 * * *"
+            - v1a5:
+                capi_version: v1alpha4
+                capm3_version: v1alpha5
+                capm3_branch: release-0.5
+                schedule: "H 20 * * *"