Use separate job template for onap-healthcheck jobs

Change-Id: Ibbcf57a50a6d132d5778b82e9fa948ff2cf2d52f
diff --git a/jjb/cloud-infra/cloud-infra-periodic-onap.yaml b/jjb/cloud-infra/cloud-infra-periodic-onap.yaml
index 68369b7..781e57b 100644
--- a/jjb/cloud-infra/cloud-infra-periodic-onap.yaml
+++ b/jjb/cloud-infra/cloud-infra-periodic-onap.yaml
@@ -44,7 +44,6 @@
       - 'dublin':
           nordix-branch: master
           onap-version: 4.0.0-ONAP
-          onap-flavor: full
           engine-version: master
           engine-refspec: "refs/changes/71/1771/4"
           deploy-scenario-version: "9a215b7935ab2b14cc7451ba15ea575e62e26da7"
@@ -53,7 +52,6 @@
       - 'master':
           nordix-branch: master
           onap-version: master
-          onap-flavor: full
           engine-version: master
           engine-refspec: master
           deploy-scenario-version: master
@@ -72,23 +70,35 @@
           installer-type: kubespray
           slave-label: 'jumphost-onap-ubuntu1804'
 
-    phase:
+    onap-other-phases:
       - onap-deploy:
           build-timeout: 150
       - oom-healthcheck:
           build-timeout: 30
           test-type: oom-healthcheck
-      - onap-healthcheck:
-          build-timeout: 30
-          test-type: onap-healthcheck
       - promote-onap:
           build-timeout: 5
       - delete-stack:
           build-timeout: 5
 
+    onap-healthcheck-phases:
+      - onap-healthcheck-core:
+          build-timeout: 30
+          test-type: onap-healthcheck
+      - onap-healthcheck-small:
+          build-timeout: 30
+          test-type: onap-healthcheck
+      - onap-healthcheck-medium:
+          build-timeout: 30
+          test-type: onap-healthcheck
+      - onap-healthcheck-full:
+          build-timeout: 30
+          test-type: onap-healthcheck
+
     jobs:
       - '{deploy-scenario}-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
-      - '{phase}-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
+      - '{onap-other-phases}-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
+      - '{onap-healthcheck-phases}-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
 
 - job-template:
     name: '{deploy-scenario}-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
@@ -100,74 +110,7 @@
     concurrent: true
 
     parameters:
-      - project-parameters:
-          project: '{project}'
-          branch: '{nordix-branch}'
-      - nordix-gerrit-parameters
-      - label:
-          name: SLAVE_LABEL
-          default: '{slave-label}'
-          description: 'Slave label to schedule this job on. All slaves have Ubuntu1604 no matter what distro target nodes use'
-      - string:
-          name: DISTRO
-          default: '{distro}'
-          description: 'Distribution to use for configuring target nodes (networking etc.)'
-      - string:
-          name: PROVISIONER_TYPE
-          default: '{provisioner-type}'
-          description: 'Provisioner to use for provisioning nodes'
-      - string:
-          name: INSTALLER_TYPE
-          default: '{installer-type}'
-          description: 'Installer to use for deploying the scenario'
-      - string:
-          name: DEPLOY_SCENARIO
-          default: '{deploy-scenario}'
-          description: 'Scenario to deploy and test'
-      - string:
-          name: DEPLOY_TYPE
-          default: '{type}'
-          description: 'Type of the deployment'
-      - string:
-          name: ONAP_VERSION
-          default: '{onap-version}'
-          description: 'ONAP version to deploy'
-      - string:
-          name: ONAP_FLAVOR
-          default: '{onap-flavor}'
-          description: 'ONAP flavor to deploy - could be core, small, medium, full. Also used for xtesting as run_type.'
-      - string:
-          name: ENGINE_REPO_URL
-          default: 'https://gerrit.nordix.org/infra/engine.git'
-          description: 'URL to Nordix cloud-infra/engine repository'
-      - string:
-          name: ENGINE_VERSION
-          default: '{engine-version}'
-          description: 'Development purposes only! Nordix Cloud Infra Engine version to use for deploying ONAP. Could be sha, branch'
-      - string:
-          name: ENGINE_REFSPEC
-          default: '{engine-refspec}'
-          description: 'Development purposes only! Nordix Cloud Infra Engine version to use for deploying ONAP. Must be refspec.'
-      - string:
-          name: DEPLOY_SCENARIO_VERSION
-          default: '{deploy-scenario-version}'
-          description: 'Development purposes only! Nordix Cloud Infra Scenario version to use for deploying ONAP. Depends on DEPLOY_SCENARIO_REFSPEC and could be sha, branch.'
-      - string:
-          name: DEPLOY_SCENARIO_REFSPEC
-          default: '{deploy-scenario-refspec}'
-          description: 'Development purposes only! Nordix Cloud Infra Scenario version to use for deploying ONAP. Depends on DEPLOY_SCENARIO_VERSION and must be refspec.'
-      - string:
-          name: XTESTING_REPO_URL
-          default: 'https://gerrit.nordix.org/opnfv/xtesting-onap.git'
-          description: 'URL to Nordix xtesting-onap repository'
-      - string:
-          name: ENGINE_ANSIBLE_PARAMS
-          default: ''
-          description: 'Extra parameters that can be added when run the play books.'
-      - string:
-          name: CLEANUP
-          default: 'true'
-          description: 'Cleanup leftovers of the previous run'
+      - onap-parameter-macro
 
     properties:
       - logrotate
@@ -225,7 +168,7 @@
               kill-phase-on: FAILURE
               abort-all-job: true
       - multijob:
-          name: Kubernetes and OOM Healthcheck using xtesting
+          name: K8S and OOM Healthcheck using xtesting
           condition: ALWAYS
           projects:
             - name: 'oom-healthcheck-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
@@ -250,17 +193,18 @@
               kill-phase-on: NEVER
               abort-all-job: false
       - multijob:
-          name: ONAP Healthcheck using xtesting (core, small, medium, and full functionality)
+          name: ONAP Healthcheck using xtesting
           condition: ALWAYS
           projects:
-            - name: 'onap-healthcheck-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
+            - name: 'onap-healthcheck-core-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
               current-parameters: false
               predefined-parameters: |
+                SLAVE_LABEL=$SLAVE_LABEL
                 DISTRO=$DISTRO
-                DEPLOY_TYPE=$DEPLOY_TYPE
                 PROVISIONER_TYPE=$PROVISIONER_TYPE
                 INSTALLER_TYPE=$INSTALLER_TYPE
                 DEPLOY_SCENARIO=$DEPLOY_SCENARIO
+                DEPLOY_TYPE=$DEPLOY_TYPE
                 ONAP_VERSION=$ONAP_VERSION
                 ONAP_FLAVOR=core
                 TEST_TYPE=onap-healthcheck
@@ -268,21 +212,21 @@
                 ENGINE_REFSPEC=$ENGINE_REFSPEC
                 DEPLOY_SCENARIO_VERSION=$DEPLOY_SCENARIO_VERSION
                 DEPLOY_SCENARIO_REFSPEC=$DEPLOY_SCENARIO_REFSPEC
-                ENGINE_ANSIBLE_PARAMS=$ENGINE_ANSIBLE_PARAMS
                 XTESTING_REPO_URL=$XTESTING_REPO_URL
                 ENGINE_ANSIBLE_PARAMS=$ENGINE_ANSIBLE_PARAMS
                 CLEANUP=$CLEANUP
               node-parameters: true
               kill-phase-on: NEVER
               abort-all-job: false
-            - name: 'onap-healthcheck-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
+            - name: 'onap-healthcheck-small-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
               current-parameters: false
               predefined-parameters: |
+                SLAVE_LABEL=$SLAVE_LABEL
                 DISTRO=$DISTRO
-                DEPLOY_TYPE=$DEPLOY_TYPE
                 PROVISIONER_TYPE=$PROVISIONER_TYPE
                 INSTALLER_TYPE=$INSTALLER_TYPE
                 DEPLOY_SCENARIO=$DEPLOY_SCENARIO
+                DEPLOY_TYPE=$DEPLOY_TYPE
                 ONAP_VERSION=$ONAP_VERSION
                 ONAP_FLAVOR=small
                 TEST_TYPE=onap-healthcheck
@@ -290,21 +234,21 @@
                 ENGINE_REFSPEC=$ENGINE_REFSPEC
                 DEPLOY_SCENARIO_VERSION=$DEPLOY_SCENARIO_VERSION
                 DEPLOY_SCENARIO_REFSPEC=$DEPLOY_SCENARIO_REFSPEC
-                ENGINE_ANSIBLE_PARAMS=$ENGINE_ANSIBLE_PARAMS
                 XTESTING_REPO_URL=$XTESTING_REPO_URL
                 ENGINE_ANSIBLE_PARAMS=$ENGINE_ANSIBLE_PARAMS
                 CLEANUP=$CLEANUP
               node-parameters: true
               kill-phase-on: NEVER
               abort-all-job: false
-            - name: 'onap-healthcheck-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
+            - name: 'onap-healthcheck-medium-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
               current-parameters: false
               predefined-parameters: |
+                SLAVE_LABEL=$SLAVE_LABEL
                 DISTRO=$DISTRO
-                DEPLOY_TYPE=$DEPLOY_TYPE
                 PROVISIONER_TYPE=$PROVISIONER_TYPE
                 INSTALLER_TYPE=$INSTALLER_TYPE
                 DEPLOY_SCENARIO=$DEPLOY_SCENARIO
+                DEPLOY_TYPE=$DEPLOY_TYPE
                 ONAP_VERSION=$ONAP_VERSION
                 ONAP_FLAVOR=medium
                 TEST_TYPE=onap-healthcheck
@@ -312,21 +256,21 @@
                 ENGINE_REFSPEC=$ENGINE_REFSPEC
                 DEPLOY_SCENARIO_VERSION=$DEPLOY_SCENARIO_VERSION
                 DEPLOY_SCENARIO_REFSPEC=$DEPLOY_SCENARIO_REFSPEC
-                ENGINE_ANSIBLE_PARAMS=$ENGINE_ANSIBLE_PARAMS
                 XTESTING_REPO_URL=$XTESTING_REPO_URL
                 ENGINE_ANSIBLE_PARAMS=$ENGINE_ANSIBLE_PARAMS
                 CLEANUP=$CLEANUP
               node-parameters: true
               kill-phase-on: NEVER
               abort-all-job: false
-            - name: 'onap-healthcheck-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
+            - name: 'onap-healthcheck-full-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
               current-parameters: false
               predefined-parameters: |
+                SLAVE_LABEL=$SLAVE_LABEL
                 DISTRO=$DISTRO
-                DEPLOY_TYPE=$DEPLOY_TYPE
                 PROVISIONER_TYPE=$PROVISIONER_TYPE
                 INSTALLER_TYPE=$INSTALLER_TYPE
                 DEPLOY_SCENARIO=$DEPLOY_SCENARIO
+                DEPLOY_TYPE=$DEPLOY_TYPE
                 ONAP_VERSION=$ONAP_VERSION
                 ONAP_FLAVOR=full
                 TEST_TYPE=onap-healthcheck
@@ -334,7 +278,6 @@
                 ENGINE_REFSPEC=$ENGINE_REFSPEC
                 DEPLOY_SCENARIO_VERSION=$DEPLOY_SCENARIO_VERSION
                 DEPLOY_SCENARIO_REFSPEC=$DEPLOY_SCENARIO_REFSPEC
-                ENGINE_ANSIBLE_PARAMS=$ENGINE_ANSIBLE_PARAMS
                 XTESTING_REPO_URL=$XTESTING_REPO_URL
                 ENGINE_ANSIBLE_PARAMS=$ENGINE_ANSIBLE_PARAMS
                 CLEANUP=$CLEANUP
@@ -365,7 +308,7 @@
               kill-phase-on: NEVER
               abort-all-job: false
       - multijob:
-          name: Cleanup
+          name: Delete Stack
           condition: ALWAYS
           projects:
             - name: 'delete-stack-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
@@ -389,7 +332,7 @@
               abort-all-job: false
 
 - job-template:
-    name: '{phase}-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
+    name: '{onap-other-phases}-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
 
     disabled: false
 
@@ -399,77 +342,7 @@
       - logrotate
 
     parameters:
-      - project-parameters:
-          project: '{project}'
-          branch: '{nordix-branch}'
-      - nordix-gerrit-parameters
-      - label:
-          name: SLAVE_LABEL
-          default: 'jumphost-onap-ubuntu1804'
-          description: 'Slave label to schedule this job on. All slaves have Ubuntu1604 no matter what distro target nodes use'
-      - string:
-          name: DISTRO
-          default: 'ubuntu1804'
-          description: 'Distribution to use for configuring target nodes (networking etc.). Overriden by upstream job.'
-      - string:
-          name: PROVISIONER_TYPE
-          default: 'heat'
-          description: 'Provisioner to use for provisioning nodes'
-      - string:
-          name: INSTALLER_TYPE
-          default: 'kubespray'
-          description: 'Installer to use for deploying the scenario'
-      - string:
-          name: DEPLOY_SCENARIO
-          default: 'onap-oom-nofeature'
-          description: 'Scenario to deploy and test'
-      - string:
-          name: HEAT_ENVIRONMENT_FILE
-          default: "file://$WORKSPACE/.cache/repos/swconfig/scenarios/$DEPLOY_SCENARIO/$INSTALLER_TYPE/role/$DEPLOY_SCENARIO/files/heat-environment-full.yaml"
-          description: 'Type of the deployment'
-      - string:
-          name: DEPLOY_TYPE
-          default: 'cloud'
-          description: 'Type of the deployment. Overriden by upstream job.'
-      - string:
-          name: ONAP_VERSION
-          default: 'master'
-          description: 'ONAP version to deploy'
-      - string:
-          name: ONAP_FLAVOR
-          default: '{onap-flavor}'
-          description: 'ONAP flavor to deploy - could be core, small, medium, full. Also used for xtesting as run_type.'
-      - string:
-          name: TEST_TYPE
-          default: 'oom-healthcheck'
-          description: 'Test type to run. Could be oom-healthcheck or onap-healthcheck'
-      - string:
-          name: ENGINE_VERSION
-          default: 'master'
-          description: 'Development purposes only! Nordix Cloud Infra Engine version to use for deploying ONAP. Could be sha, branch'
-      - string:
-          name: ENGINE_REFSPEC
-          default: 'master'
-          description: 'Development purposes only! Nordix Cloud Infra Engine version to use for deploying ONAP. Must be refspec.'
-      - string:
-          name: DEPLOY_SCENARIO_VERSION
-          default: 'master'
-          description: 'Development purposes only! Nordix Cloud Infra Scenario version to use for deploying ONAP. Depends on DEPLOY_SCENARIO_REFSPEC and could be sha, branch.'
-      - string:
-          name: DEPLOY_SCENARIO_REFSPEC
-          default: 'master'
-          description: 'Development purposes only! Nordix Cloud Infra Scenario version to use for deploying ONAP. Depends on DEPLOY_SCENARIO_VERSION and must be refspec.'
-      - string:
-          name: XTESTING_REPO_URL
-          default: 'https://gerrit.nordix.org/opnfv/xtesting-onap.git'
-          description: 'URL to Nordix xtesting-onap repository'
-      - string:
-          name: ENGINE_ANSIBLE_PARAMS
-          default: ''
-          description: 'Extra parameters that can be added when run the play books.'
-      - string:
-          name: CLEANUP
-          default: 'true'
+      - onap-parameter-macro
 
     wrappers:
       - credentials-binding:
@@ -492,6 +365,42 @@
     builders:
       - description-setter:
           description: $INSTALLER_TYPE $DEPLOY_SCENARIO
-      - '{phase}-macro'
+      - '{onap-other-phases}-macro'
+
+- job-template:
+    name: '{onap-healthcheck-phases}-periodic-{distro}-{installer-type}-{type}-{onap-branch}'
+
+    disabled: false
+
+    concurrent: true
+
+    properties:
+      - logrotate
+
+    parameters:
+      - onap-parameter-macro
+
+    wrappers:
+      - credentials-binding:
+          - file:
+              credential-id: nordix-jenkins-openrcfile-city-frankfurt-defaultproject
+              variable: OPENRC_FILE
+      - mask-passwords
+      - build-timeout:
+          timeout: '{build-timeout}'
+      - fix-workspace-permissions
+
+    scm:
+      - git-scm:
+          ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
+          branch: '{nordix-branch}'
+          refspec: ''
+          wipe_workspace: true
+          clean_before: false
+
+    builders:
+      - description-setter:
+          description: $INSTALLER_TYPE $DEPLOY_SCENARIO
+      - 'onap-healthcheck-macro'
 
 # vim: set ts=2 sw=2 expandtab:
diff --git a/jjb/cloud-infra/onap-macros.yaml b/jjb/cloud-infra/onap-macros.yaml
index d1e7894..27860e8 100644
--- a/jjb/cloud-infra/onap-macros.yaml
+++ b/jjb/cloud-infra/onap-macros.yaml
@@ -19,6 +19,81 @@
 # ============LICENSE_END=========================================================
 
 # macros used by all job types
+- parameter:
+    name: 'onap-parameter-macro'
+    parameters:
+      - project-parameters:
+          project: '{project}'
+          branch: '{nordix-branch}'
+      - nordix-gerrit-parameters
+      - label:
+          name: SLAVE_LABEL
+          default: '{slave-label}'
+          description: 'Slave label to schedule this job on. All slaves have Ubuntu1604 no matter what distro target nodes use'
+      - string:
+          name: DISTRO
+          default: '{distro}'
+          description: 'Distribution to use for configuring target nodes (networking etc.)'
+      - string:
+          name: PROVISIONER_TYPE
+          default: '{provisioner-type}'
+          description: 'Provisioner to use for provisioning nodes'
+      - string:
+          name: INSTALLER_TYPE
+          default: '{installer-type}'
+          description: 'Installer to use for deploying the scenario'
+      - string:
+          name: DEPLOY_SCENARIO
+          default: '{deploy-scenario}'
+          description: 'Scenario to deploy and test'
+      - string:
+          name: DEPLOY_TYPE
+          default: '{type}'
+          description: 'Type of the deployment'
+      - string:
+          name: HEAT_ENVIRONMENT_FILE
+          default: "file://$WORKSPACE/.cache/repos/swconfig/scenarios/$DEPLOY_SCENARIO/$INSTALLER_TYPE/role/$DEPLOY_SCENARIO/files/heat-environment-full.yaml"
+          description: 'Type of the deployment'
+      - string:
+          name: ONAP_VERSION
+          default: '{onap-version}'
+          description: 'ONAP version to deploy'
+      - string:
+          name: ONAP_FLAVOR
+          default: 'full'
+          description: 'ONAP flavor to deploy - could be core, small, medium, full. Also used for xtesting as run_type.'
+      - string:
+          name: TEST_TYPE
+          default: 'oom-healthcheck'
+          description: 'Test type to run. Could be oom-healthcheck or onap-healthcheck'
+      - string:
+          name: ENGINE_VERSION
+          default: '{engine-version}'
+          description: 'Development purposes only! Nordix Cloud Infra Engine version to use for deploying ONAP. Could be sha, branch'
+      - string:
+          name: ENGINE_REFSPEC
+          default: '{engine-refspec}'
+          description: 'Development purposes only! Nordix Cloud Infra Engine version to use for deploying ONAP. Must be refspec.'
+      - string:
+          name: DEPLOY_SCENARIO_VERSION
+          default: '{deploy-scenario-version}'
+          description: 'Development purposes only! Nordix Cloud Infra Scenario version to use for deploying ONAP. Depends on DEPLOY_SCENARIO_REFSPEC and could be sha, branch.'
+      - string:
+          name: DEPLOY_SCENARIO_REFSPEC
+          default: '{deploy-scenario-refspec}'
+          description: 'Development purposes only! Nordix Cloud Infra Scenario version to use for deploying ONAP. Depends on DEPLOY_SCENARIO_VERSION and must be refspec.'
+      - string:
+          name: XTESTING_REPO_URL
+          default: 'https://gerrit.nordix.org/opnfv/xtesting-onap.git'
+          description: 'URL to Nordix xtesting-onap repository'
+      - string:
+          name: ENGINE_ANSIBLE_PARAMS
+          default: ''
+          description: 'Extra parameters that can be added when run the play books.'
+      - string:
+          name: CLEANUP
+          default: 'true'
+          description: 'Cleanup leftovers of the previous run'
 - builder:
     name: 'onap-deploy-macro'
     builders: