cloud-infra: Enable engine verification on OpenStack 36/2636/5
authorFatih Degirmenci <fdegir@gmail.com>
Thu, 17 Oct 2019 09:20:59 +0000 (11:20 +0200)
committerFatih Degirmenci <fdegir@gmail.com>
Thu, 17 Oct 2019 12:19:25 +0000 (14:19 +0200)
As we fully support heat as the new provisioner, it is important
to verify changes coming to infra/engine repo on OpenStack as well
in order not to break things.

Change-Id: I2805d5905d148a33c9b8ceffe446465534132efe

jjb/cloud-infra/cloud-infra-deploy.sh
jjb/cloud-infra/cloud-infra-test.sh
jjb/cloud-infra/cloud-infra-verify-engine.yaml
jjb/cloud-infra/delete-heat-stack.sh

index fd9f6a41d42b5f154f17bb6130b9c66cb5c1ae6e..71062a699e91be57d22efa1cbfd22fc6836f56fb 100644 (file)
@@ -39,11 +39,17 @@ set -o pipefail
 
 # we don't support ONAP scenario verification because it is expensive
 # TODO: we need to find a way to verify those patches in a cheaper way
-if [[ "$DEPLOY_SCENARIO" =~ "onap" ]]; then
+if [[ "$DEPLOY_SCENARIO" =~ "onap-" ]]; then
   echo "Info: ONAP scenario verification has not been implemented yet!"
   exit 0
 fi
 
+# we don't support OpenStack scenario verification on OpenStack yet
+if [[ "$DEPLOY_SCENARIO" =~ "os-" ]] && [[ "$PROVISIONER_TYPE" == "heat" ]]; then
+  echo "Info: OpenStack scenario verification on OpenStack has not been implemented yet!"
+  exit 0
+fi
+
 if [[ $DEPLOY_TYPE == "baremetal" ]]; then
   PDF="https://gerrit.nordix.org/gitweb?p=infra/hwconfig.git;a=blob_plain;f=pods/${NODE_NAME}-pdf.yml"
   IDF="https://gerrit.nordix.org/gitweb?p=infra/hwconfig.git;a=blob_plain;f=pods/${NODE_NAME}-idf.yml"
@@ -55,7 +61,7 @@ fi
 if [[ $PROVISIONER_TYPE == "bifrost" ]]; then
   DEPLOY_CMD="./engine/deploy.sh -c -r $PROVISIONER_TYPE -d $INSTALLER_TYPE -o $DISTRO -s $DEPLOY_SCENARIO -p $PDF -i $IDF"
 elif [[ $PROVISIONER_TYPE == "heat" ]]; then
-  DEPLOY_CMD="./engine/deploy.sh -c -r $PROVISIONER_TYPE -d $INSTALLER_TYPE -o $DISTRO -s $DEPLOY_SCENARIO -u /tmp/openrc"
+  DEPLOY_CMD="./engine/deploy.sh -c -r $PROVISIONER_TYPE -d $INSTALLER_TYPE -o $DISTRO -s $DEPLOY_SCENARIO -u /tmp/openrc -e $HEAT_ENVIRONMENT_FILE"
 else
   echo "Error: Unsupported provisioner type. Must either be bifrost or heat!"
   exit 1
index 7d6936043bcfbac2f69f7ef6a4ab2617f229e9f1..bb6bf7d60f9512d8e132a7b2f0f7cc8849c4b607 100644 (file)
@@ -35,6 +35,12 @@ if [[ "$DEPLOY_SCENARIO" =~ "onap" ]]; then
   exit 0
 fi
 
+# we don't support testing of the deployments done on OpenStack cloud using heat yet
+if [[ $DEPLOY_TYPE == "cloud" ]]; then
+  echo "Info: Testing of cloud deployments has not been implemented yet!"
+  exit 0
+fi
+
 # execute cloud engine test.sh script with arguments
 cd $WORKSPACE
 ./test/test.sh -c -f $TEST_FW -t $TEST_SUITE -s $DEPLOY_SCENARIO -d $YARDSTICK_DISPATCHER
index 34bd879aac1e950f52f8a91f0ef6b44b607460d5..837af99aac90995fe9e145d644f5d069f540ca9c 100644 (file)
 
     distro:
       - ubuntu1804:
-          slave-label: vpod-deploy-ubuntu1804
           disabled: false
           successful: false
           failed: false
           unstable: false
           notbuilt: false
       - centos7:
-          slave-label: vpod-deploy-centos7
           disabled: true
           successful: true
           failed: true
           unstable: true
           notbuilt: true
+    cloud:
+      - city:
+          slave-label: 'city-jumphost-onap-ubuntu1804'
+          openrc-credentials-file: 'est-jenkins-openrcfile-city-karlskrona-onap'
 
     type:
-      - virtual
+      - virtual:
+          provisioner-type: 'bifrost'
+      - cloud:
+          provisioner-type: 'heat'
 
     phase:
       - deploy:
           build-timeout: 30
 
     jobs:
-      - 'cloud-infra-verify-engine-{distro}-{type}-{stream}'
+      - 'cloud-infra-verify-engine-{distro}-{cloud}-{type}-{stream}'
       - 'cloud-infra-verify-engine-{distro}-{phase}-{type}-{stream}'
 
 - job-template:
-    name: 'cloud-infra-verify-engine-{distro}-{type}-{stream}'
+    name: 'cloud-infra-verify-engine-{distro}-{cloud}-{type}-{stream}'
 
     project-type: multijob
 
           name: DISTRO
           default: '{distro}'
           description: 'Distribution to use for configuring target nodes (networking etc.)'
+      - string:
+          name: PROVISIONER_TYPE
+          default: '{provisioner-type}'
+          description: 'Provisioner type to use'
       - string:
           name: DEPLOY_TYPE
           default: '{type}'
           description: 'Type of the deployment'
+      - string:
+          name: HEAT_ENVIRONMENT_FILENAME
+          default: 'heat-environment-{cloud}-{distro}.yaml'
+          description: 'Name of heat-environment file to use.'
+      - string:
+          name: STACK_NAME
+          default: "nordix-cicd-verify-engine-{distro}-$BUILD_NUMBER"
+          description: 'Name of the created stack'
       - string:
           name: USE_PREBUILT_DEPLOYMENT_IMAGE
           default: 'true'
           name: YARDSTICK_DISPATCHER
           default: 'file'
           description: 'Dispatcher to use for Yardstick reporting'
+      - string:
+          name: DELETE_STACK
+          default: 'yes'
+          description: 'Delete the stack upon completion of the build'
       - string:
           name: CLEANUP
           default: 'true'
     wrappers:
       - credentials-binding:
           - file:
-              credential-id: est-jenkins-openrcfile-city-karlskrona-onap
+              credential-id: '{openrc-credentials-file}'
               variable: OPENRC_FILE
       - mask-passwords
       - build-timeout:
               predefined-parameters: |
                 DISTRO=$DISTRO
                 DEPLOY_TYPE=$DEPLOY_TYPE
+                PROVISIONER_TYPE=$PROVISIONER_TYPE
+                STACK_NAME=$STACK_NAME
+                HEAT_ENVIRONMENT_FILENAME=$HEAT_ENVIRONMENT_FILENAME
                 USE_PREBUILT_DEPLOYMENT_IMAGE=$USE_PREBUILT_DEPLOYMENT_IMAGE
                 CLEANUP=$CLEANUP
                 GERRIT_PROJECT=$GERRIT_PROJECT
               predefined-parameters: |
                 DISTRO=$DISTRO
                 DEPLOY_TYPE=$DEPLOY_TYPE
+                PROVISIONER_TYPE=$PROVISIONER_TYPE
+                STACK_NAME=$STACK_NAME
+                HEAT_ENVIRONMENT_FILENAME=$HEAT_ENVIRONMENT_FILENAME
                 USE_PREBUILT_DEPLOYMENT_IMAGE=$USE_PREBUILT_DEPLOYMENT_IMAGE
                 TEST_SUITE=$TEST_SUITE
                 YARDSTICK_DISPATCHER=$YARDSTICK_DISPATCHER
               kill-phase-on: FAILURE
               abort-all-job: true
 
+    publishers:
+      - postbuildscript:
+          builders:
+            - role: SLAVE
+              build-on:
+                - SUCCESS
+                - FAILURE
+                - ABORTED
+                - NOT_BUILT
+                - UNSTABLE
+              build-steps:
+                - shell:
+                    !include-raw-escape: ./wait-for-pkg-manager.sh
+                - shell:
+                    !include-raw: ./delete-heat-stack.sh
+
 - job-template:
     name: 'cloud-infra-verify-engine-{distro}-{phase}-{type}-{stream}'
 
           name: DEPLOY_TYPE
           default: 'virtual'
           description: 'Type of the deployment. Overriden by upstream job.'
+      - string:
+          name: PROVISIONER_TYPE
+          default: 'bifrost'
+          description: 'Provisioner type to use. Overriden by upstream job.'
+      - string:
+          name: HEAT_ENVIRONMENT_FILENAME
+          default: "heat-environment-city-ubuntu1804.yaml"
+          description: 'Name of heat-environment file to use.'
+      - string:
+          name: HEAT_ENVIRONMENT_FILE
+          default: "file://$WORKSPACE/engine/provisioner/heat/playbooks/roles/install-configure-heat/files/$HEAT_ENVIRONMENT_FILENAME"
+          description: 'Location of heat-environment file to use.'
+      - string:
+          name: STACK_NAME
+          default: "nordix-cicd-verify-engine-{distro}-$BUILD_NUMBER"
+          description: 'Name of the created stack'
       - string:
           name: USE_PREBUILT_DEPLOYMENT_IMAGE
           default: 'false'
           default: 'false'
 
     wrappers:
-      - credentials-binding:
-          - file:
-              credential-id: est-jenkins-openrcfile-city-karlskrona-onap
-              variable: OPENRC_FILE
       - mask-passwords
       - build-timeout:
           timeout: '{build-timeout}'
index aa3478d4ebd39e94c2d2b7adc3a313208da096db..2bd6c732a10675b8a1ba947b78b728d2279506fb 100644 (file)
 set -o errexit
 set -o nounset
 
+# proceed only if the deployment is done on openstack
+if [[ $DEPLOY_TYPE != "cloud" ]]; then
+  echo "-------------------------------------------------------------------------"
+  echo "Info: It is not an OpenStack deployment so nothing to delete!"
+  echo "-------------------------------------------------------------------------"
+  exit 0
+fi
+
 if [[ "$DELETE_STACK" != "yes" ]]; then
   echo "-------------------------------------------------------------------------"
   echo "Info: Stack will not be deleted upon the completion of the job!"