engine: Enable testing of online deployments 63/4063/2
authorFatih Degirmenci <fdegir@gmail.com>
Tue, 17 Mar 2020 16:00:27 +0000 (16:00 +0000)
committerFatih Degirmenci <fdegir@gmail.com>
Tue, 17 Mar 2020 16:05:00 +0000 (16:05 +0000)
Change-Id: I6dfe77d891fe89a7c548915f952fb313cf1a9e3f

jjb/engine/engine-verify-jobs/engine-verify-deployment-parent-jobs.yaml
jjb/engine/engine-verify-jobs/engine-verify-macros.yaml
jjb/engine/engine-verify-jobs/engine-verify-offline-deploy-test.yaml
jjb/engine/engine-verify-jobs/engine-verify-online-deploy-test.yaml
jjb/engine/engine-verify-jobs/scripts/test.sh
jjb/engine/engine-verify-jobs/scripts/wait-for-pkg-manager.sh [new file with mode: 0755]

index bee203e70947da9ff45fc220a393cfb54d63702e..5376bb06fd453e14399b6c1069467f995e965142 100644 (file)
       - online:
           disabled: false
           execution-mode: online-deployment
-          successful: true
-          failed: true
-          unstable: true
-          notbuilt: true
+          successful: false
+          failed: false
+          unstable: false
+          notbuilt: false
       - offline:
           disabled: false
           execution-mode: offline-deployment
@@ -74,7 +74,7 @@
           description: 'Distribution to use for configuring target nodes (networking etc.)'
       - string:
           name: VERBOSITY
-          default: 'false'
+          default: 'true'
           description: 'Verbosity setting for the engine - true or false - default is false'
       - string:
           name: NORDIX_ARM_PUBLIC_IP
           clean_before: false
 
     builders:
+      - 'engine-wait-pkg-mgr-macro'
       - 'engine-generate-ssh-keypair-macro'
       - 'engine-packaging-macro'
       - 'engine-upload-artifact-macro'
index 1bb5cb83ca08e08597092cafc7a94ac608031d72..f7f443caf4cf8af1b5da650b18f740cc1d8364da 100644 (file)
@@ -69,3 +69,9 @@
     builders:
       - shell:
           !include-raw: ./scripts/delete-heat-stack.sh
+
+- builder:
+    name: 'engine-wait-pkg-mgr-macro'
+    builders:
+      - shell:
+          !include-raw: ./scripts/wait-for-pkg-manager.sh
index ee94e3abb3c6ab68e0d60417ddf9525bf9559c2d..027657aa8a960f6a1ed392dfe7194eb054708c1f 100644 (file)
           description: 'Name of heat-environment file to use.'
       - string:
           name: STACK_NAME
-          default: "nordix-cicd-verify-engine-{distro}-$BUILD_NUMBER"
+          default: "nordix-cicd-verify-engine-offline-{distro}-$BUILD_NUMBER"
           description: 'Name of the created stack'
       - string:
           name: KEYPAIR_NAME
-          default: "keypair-nordix-cicd-verify-engine-{distro}-$BUILD_NUMBER"
+          default: "keypair-nordix-cicd-verify-offline-engine-{distro}-$BUILD_NUMBER"
           description: 'Name of the created keypair'
       - string:
           name: USE_PREBUILT_DEPLOYMENT_IMAGE
           default: 'true'
           description: 'Use prebuilt deployment image while running as part of CI/CD'
+      - string:
+          name: TEST_REPO_URL
+          default: 'https://gerrit.nordix.org/infra/test.git'
+          description: 'URL to clone the test repo from'
+      - string:
+          name: TEST_FW
+          default: 'functest'
+          description: 'Test framework to use'
       - string:
           name: TEST_SUITE
           default: 'healthcheck'
           description: 'Test suite to run'
-      - string:
-          name: YARDSTICK_DISPATCHER
-          default: 'file'
-          description: 'Dispatcher to use for Yardstick reporting'
       - string:
           name: DELETE_STACK
-          default: 'yes'
+          default: 'true'
           description: 'Delete the stack upon completion of the build'
 
     properties:
       - logrotate
-#      - build-blocker:
-#          use-build-blocker: true
-#          blocking-jobs:
-#            - 'engine-verify-online-deploy-test-.*'
-#            - 'engine-verify-offline-deploy-test-.*'
-#          block-level: 'NODE'
       - throttle:
           max-per-node: 1
           max-total: 3
           single-use: True
 
     builders:
+      - 'engine-wait-pkg-mgr-macro'
+      - shell: |
+          #!/bin/bash
+          sudo sed -i 's/^search/# search/' /etc/resolv.conf
       - 'engine-generate-ssh-keypair-macro'
       - 'engine-download-artifact-macro'
       - multijob:
               current-parameters: true
               node-parameters: true
               kill-phase-on: FAILURE
-              abort-all-job: true
+              abort-all-job: false
       - multijob:
           name: "Offline Testing on {type} instances"
           condition: SUCCESSFUL
               current-parameters: true
               node-parameters: true
               kill-phase-on: FAILURE
-              abort-all-job: true
+              abort-all-job: false
       - conditional-step:
           condition-kind: and
           condition-operands:
index 61d9d18bf233f658adac52f251cbfc9cd0d2a3e1..c295c788cf5dd7c6e9d33ec5cdbb44ca5cb9b77a 100644 (file)
           description: 'Name of heat-environment file to use.'
       - string:
           name: STACK_NAME
-          default: "nordix-cicd-verify-engine-{distro}-$BUILD_NUMBER"
+          default: "nordix-cicd-verify-engine-online-{distro}-$BUILD_NUMBER"
           description: 'Name of the created stack'
       - string:
           name: KEYPAIR_NAME
-          default: "keypair-nordix-cicd-verify-engine-{distro}-$BUILD_NUMBER"
+          default: "keypair-nordix-cicd-verify-online-engine-{distro}-$BUILD_NUMBER"
           description: 'Name of the created keypair'
       - string:
           name: USE_PREBUILT_DEPLOYMENT_IMAGE
           default: 'true'
           description: 'Use prebuilt deployment image while running as part of CI/CD'
+      - string:
+          name: TEST_REPO_URL
+          default: 'https://gerrit.nordix.org/infra/test.git'
+          description: 'URL to clone the test repo from'
+      - string:
+          name: TEST_FW
+          default: 'functest'
+          description: 'Test framework to use'
       - string:
           name: TEST_SUITE
           default: 'healthcheck'
           description: 'Test suite to run'
-      - string:
-          name: YARDSTICK_DISPATCHER
-          default: 'file'
-          description: 'Dispatcher to use for Yardstick reporting'
       - string:
           name: DELETE_STACK
-          default: 'yes'
+          default: 'true'
           description: 'Delete the stack upon completion of the build'
 
     properties:
       - logrotate
-#      - build-blocker:
-#          use-build-blocker: true
-#          blocking-jobs:
-#            - 'engine-verify-online-deploy-test-.*'
-#            - 'engine-verify-offline-deploy-test-.*'
-#          block-level: 'NODE'
       - throttle:
           max-per-node: 1
           max-total: 3
           clean_before: false
 
     builders:
+      - 'engine-wait-pkg-mgr-macro'
       - 'engine-generate-ssh-keypair-macro'
       - 'engine-download-artifact-macro'
       - multijob:
               current-parameters: true
               node-parameters: true
               kill-phase-on: FAILURE
-              abort-all-job: true
+              abort-all-job: false
       - multijob:
           name: "Online Testing on {type} instances"
           condition: SUCCESSFUL
               current-parameters: true
               node-parameters: true
               kill-phase-on: FAILURE
-              abort-all-job: true
+              abort-all-job: false
       - conditional-step:
           condition-kind: and
           condition-operands:
index a1c7f0e0391bac879daf70508ea0e7ff737f00ef..cc793530a4a700b2938f78a8f69a2b0e6d6f098c 100755 (executable)
@@ -22,4 +22,14 @@ set -o nounset
 set -o errexit
 set -o pipefail
 
-echo "Info  : Not implemented!"
+if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
+  echo "Info  : Testing of offline deployments is not currently supported!"
+  exit 0
+fi
+
+echo "Info  : Cloning infra/test repository"
+cd $HOME && /bin/rm -rf $WORKSPACE
+git clone -q $TEST_REPO_URL $WORKSPACE
+
+cd $WORKSPACE/test
+./test.sh -f $TEST_FW -t $TEST_SUITE
diff --git a/jjb/engine/engine-verify-jobs/scripts/wait-for-pkg-manager.sh b/jjb/engine/engine-verify-jobs/scripts/wait-for-pkg-manager.sh
new file mode 100755 (executable)
index 0000000..99f7544
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -o errexit
+set -o nounset
+
+source /etc/os-release || source /usr/lib/os-release
+case ${ID,,} in
+  centos)
+    pkg_mgr_cmd="yum"
+    ;;
+  ubuntu)
+    pkg_mgr_cmd="apt"
+    ;;
+esac
+
+# just wait few seconds before attempting to check pkg manager process
+sleep 10
+
+echo "Info: Waiting for completion of an existing $pkg_mgr_cmd process before proceeding..."
+while true; do
+  pkg_mgr_process=$(pgrep -f $pkg_mgr_cmd | cat)
+  if [[ -n $pkg_mgr_process ]]; then
+    sleep 10
+  else
+    break
+  fi
+done
+echo "Info: $pkg_mgr_cmd process done. Continuing..."
+
+# vim: set ts=2 sw=2 expandtab: