Merge "Update block rules on nodes"
authorSerena Feng <feng.xiaowei@zte.com.cn>
Wed, 14 Mar 2018 10:57:55 +0000 (10:57 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Wed, 14 Mar 2018 10:57:55 +0000 (10:57 +0000)
15 files changed:
jjb/functest/functest-alpine.sh
jjb/functest/functest-daily-jobs.yml
jjb/functest/functest-docker.yml [moved from jjb/releng/functest-docker.yml with 95% similarity]
jjb/functest/xtesting-docker.yml [new file with mode: 0644]
jjb/releng/opnfv-docker.yml
jjb/xci/bifrost-verify-jobs.yml
jjb/xci/xci-cleanup.sh
jjb/xci/xci-daily-jobs.yml
jjb/xci/xci-merge-jobs.yml
jjb/xci/xci-promote.sh
jjb/xci/xci-run-functest.sh
jjb/xci/xci-set-scenario.sh
jjb/xci/xci-start-deployment.sh
jjb/xci/xci-start-new-vm.sh
jjb/xci/xci-verify-jobs.yml

index 541cc78..432bbbb 100755 (executable)
@@ -177,9 +177,9 @@ if [[ ${DEPLOY_SCENARIO} =~ ^os-.* ]]; then
         run_tiers ${tiers}
     else
         if [ ${DEPLOY_TYPE} == 'baremetal' ]; then
-            tiers=(healthcheck smoke patrole features vnf parser)
+            tiers=(healthcheck smoke features vnf parser)
         else
-            tiers=(healthcheck smoke patrole features)
+            tiers=(healthcheck smoke features)
         fi
         run_tiers ${tiers}
     fi
index 099d01a..a58e0bf 100644 (file)
       - 'suite':
           job-timeout: 60
       - 'daily':
-          job-timeout: 300
+          job-timeout: 360
       - 'arm-daily':
-          job-timeout: 300
+          job-timeout: 360
 
     jobs:
       - 'functest-{installer}-{pod}-{testsuite}-{stream}'
similarity index 95%
rename from jjb/releng/functest-docker.yml
rename to jjb/functest/functest-docker.yml
index 7c576cf..909c7b0 100644 (file)
@@ -29,7 +29,6 @@
       - 'features'
       - 'components'
       - 'parser'
-      - 'patrole'
       - 'smoke'
       - 'vnf'
       - 'restapi'
@@ -73,7 +72,7 @@
     disabled: '{obj:disabled}'
 
     parameters:
-      - job-parameters:
+      - functest-job-parameters:
           project: '{project}'
           branch: '{branch}'
           slave_label: 'opnfv-build-ubuntu'
               <<: *build-job-settings
             - name: 'functest-parser-docker-build-arm64-{stream}'
               <<: *build-job-settings
-            - name: 'functest-patrole-docker-build-amd64-{stream}'
-              <<: *build-job-settings
-            - name: 'functest-patrole-docker-build-arm64-{stream}'
-              <<: *build-job-settings
             - name: 'functest-smoke-docker-build-amd64-{stream}'
               <<: *build-job-settings
             - name: 'functest-smoke-docker-build-arm64-{stream}'
               <<: *manifest-job-settings
             - name: 'functest-parser-docker-manifest-{stream}'
               <<: *manifest-job-settings
-            - name: 'functest-patrole-docker-manifest-{stream}'
-              <<: *manifest-job-settings
             - name: 'functest-smoke-docker-manifest-{stream}'
               <<: *manifest-job-settings
             - name: 'functest-vnf-docker-manifest-{stream}'
     name: 'functest-{image}-docker-build-{arch_tag}-{stream}'
     disabled: '{obj:disabled}'
     parameters:
-      - job-parameters:
+      - functest-job-parameters:
           project: '{project}'
           branch: '{branch}'
           slave_label: '{slave_label}'
 
 # parameter macro
 - parameter:
-    name: job-parameters
+    name: functest-job-parameters
     parameters:
       - project-parameter:
           project: '{project}'
             jalausuch@suse.com morgan.richomme@orange.com
             cedric.ollivier@orange.com feng.xiaowei@zte.com.cn
             juha.kosonen@nokia.com wangwulin@huawei.com
+            valentin.boucher@kontron.com
diff --git a/jjb/functest/xtesting-docker.yml b/jjb/functest/xtesting-docker.yml
new file mode 100644 (file)
index 0000000..dc26344
--- /dev/null
@@ -0,0 +1,221 @@
+---
+##############################################
+# job configuration for docker build and push
+##############################################
+- project:
+
+    name: xtesting-docker
+
+    project: functest-xtesting
+
+    stream:
+      - master:
+          branch: '{stream}'
+          disabled: false
+
+    arch_tag:
+      - 'amd64':
+          slave_label: 'opnfv-build-ubuntu'
+      - 'arm64':
+          slave_label: 'opnfv-build-ubuntu-arm'
+
+    # settings for jobs run in multijob phases
+    build-job-settings: &build-job-settings
+      current-parameters: false
+      git-revision: true
+      node-parameters: false
+      predefined-parameters: |
+        PUSH_IMAGE=$PUSH_IMAGE
+        COMMIT_ID=$COMMIT_ID
+        GERRIT_REFNAME=$GERRIT_REFNAME
+        DOCKERFILE=$DOCKERFILE
+      kill-phase-on: FAILURE
+      abort-all-jobs: false
+
+    manifest-job-settings: &manifest-job-settings
+      current-parameters: false
+      git-revision: true
+      node-parameters: false
+      predefined-parameters:
+        GERRIT_REFNAME=$GERRIT_REFNAME
+      kill-phase-on: FAILURE
+      abort-all-jobs: false
+
+    # yamllint enable rule:key-duplicates
+    jobs:
+      - "xtesting-docker-{stream}"
+      - "xtesting-docker-build-{arch_tag}-{stream}"
+      - "xtesting-docker-manifest-{stream}"
+
+########################
+# job templates
+########################
+- job-template:
+    name: 'xtesting-docker-{stream}'
+
+    project-type: multijob
+
+    disabled: '{obj:disabled}'
+
+    parameters:
+      - xtesting-job-parameters:
+          project: '{project}'
+          branch: '{branch}'
+          slave_label: 'opnfv-build-ubuntu'
+          arch_tag: 'amd64'
+
+    properties:
+      - throttle:
+          max-per-node: 1
+          option: 'project'
+
+    scm:
+      - git-scm
+
+    triggers:
+      - pollscm:
+          cron: "*/30 * * * *"
+      - gerrit-trigger-tag-created:
+          project: '{project}'
+
+    builders:
+      - multijob:
+          name: 'build xtesting images'
+          execution-type: PARALLEL
+          projects:
+            - name: 'xtesting-docker-build-amd64-{stream}'
+              <<: *build-job-settings
+            - name: 'xtesting-docker-build-arm64-{stream}'
+              <<: *build-job-settings
+      - multijob:
+          name: 'publish xtesting manifests'
+          execution-type: PARALLEL
+          projects:
+            - name: 'xtesting-docker-manifest-{stream}'
+              <<: *manifest-job-settings
+
+    publishers:
+      - 'xtesting-amd64-recipients'
+      - 'xtesting-arm64-recipients'
+
+- job-template:
+    name: 'xtesting-docker-build-{arch_tag}-{stream}'
+    disabled: '{obj:disabled}'
+    parameters:
+      - xtesting-job-parameters:
+          project: '{project}'
+          branch: '{branch}'
+          slave_label: '{slave_label}'
+          arch_tag: '{arch_tag}'
+    scm:
+      - git-scm
+    builders:
+      - shell: |
+          #!/bin/bash -ex
+          sudo arch={arch_tag} bash ./build.sh
+          exit $?
+
+- job-template:
+    name: 'xtesting-docker-manifest-{stream}'
+
+    parameters:
+      - project-parameter:
+          project: '{project}'
+          branch: '{branch}'
+      - label:
+          name: SLAVE_LABEL
+          default: 'opnfv-build-ubuntu'
+          description: 'Slave label on Jenkins'
+      - string:
+          name: PROJECT
+          default: "{project}"
+          description: "Project name used to enable job conditions"
+      - string:
+          name: GIT_BASE
+          default: https://gerrit.opnfv.org/gerrit/$PROJECT
+          description: 'Git URL to use on this Jenkins Slave'
+      - string:
+          name: REPO
+          default: "opnfv"
+          description: "Repository name for functest images"
+
+
+    disabled: '{obj:disabled}'
+
+    builders:
+      - shell: |
+          #!/bin/bash -ex
+          case "{stream}" in
+          "master")
+              tag="latest" ;;
+          *)
+              tag="{stream}" ;;
+          esac
+          sudo manifest-tool push from-args \
+              --platforms linux/amd64,linux/arm64 \
+              --template $REPO/xtesting:ARCH-$tag \
+              --target $REPO/xtesting:$tag
+          exit $?
+
+- parameter:
+    name: xtesting-job-parameters
+    parameters:
+      - project-parameter:
+          project: '{project}'
+          branch: '{branch}'
+      - label:
+          name: SLAVE_LABEL
+          default: '{slave_label}'
+          description: 'Slave label on Jenkins'
+      - string:
+          name: GIT_BASE
+          default: https://gerrit.opnfv.org/gerrit/$PROJECT
+          description: 'Git URL to use on this Jenkins Slave'
+      - string:
+          name: PUSH_IMAGE
+          default: "true"
+          description: "To enable/disable pushing the image to Dockerhub."
+      - string:
+          name: COMMIT_ID
+          default: ""
+          description: "commit id to make a snapshot docker image"
+      - string:
+          name: GERRIT_REFNAME
+          default: ""
+          description: "Docker tag to be built, e.g. refs/tags/5.0.0, refs/tags/opnfv-5.0.0, refs/tags/5.0.RC1"
+      - string:
+          name: DOCKERFILE
+          default: "Dockerfile"
+          description: "Dockerfile to use for creating the image."
+      - string:
+          name: ARCH_TAG
+          default: "{arch_tag}"
+          description: "If set, this value will be added to the docker image tag as a prefix"
+      - string:
+          name: PROJECT
+          default: "{project}"
+          description: "Project name used to enable job conditions"
+      - string:
+          name: REPO
+          default: "opnfv"
+          description: "Repository name for functest images"
+
+# publisher macros
+- publisher:
+    name: 'xtesting-arm64-recipients'
+    publishers:
+      - email:
+          recipients: >
+            cristina.pauna@enea.com
+            alexandru.avadanii@enea.com
+            delia.popescu@enea.com
+
+- publisher:
+    name: 'xtesting-amd64-recipients'
+    publishers:
+      - email:
+          recipients: >
+            jalausuch@suse.com morgan.richomme@orange.com
+            cedric.ollivier@orange.com feng.xiaowei@zte.com.cn
+            juha.kosonen@nokia.com wangwulin@huawei.com
+            valentin.boucher@kontron.com
index ac0869d..55cbc5f 100644 (file)
           project: 'yardstick'
           <<: *euphrates
           <<: *other-receivers
-      - 'xtesting':
-          project: 'functest-xtesting'
-          <<: *master
-          <<: *other-receivers
       # projects with jobs for danube
       - 'dovetail':
           project: 'dovetail'
index 7e01175..2fb7c21 100644 (file)
           recipients: fatih.degirmenci@ericsson.com yroblamo@redhat.com mchandras@suse.de jack.morgan@intel.com julienjut@gmail.com
       # yamllint enable rule:line-length
       - email-jenkins-admins-on-failure
+      - postbuildscript:
+          script-only-if-succeeded: false
+          script-only-if-failed: false
+          builders:
+            - shell:
+                !include-raw: ./xci-cleanup.sh
+
 # -------------------------------
 # trigger macros
 # -------------------------------
index ce84830..51a863d 100755 (executable)
 # what you are doing.
 #----------------------------------------------------------------------
 
+# Need to cover macros with and without parameters
+VM_NAME=$DISTRO
+VM_NAME+=_xci_vm
+
 # skip the deployment if the patch doesn't impact the deployment
 if [[ "$GERRIT_TOPIC" =~ 'skip-verify' ]]; then
     echo "Skipping the deployment!"
     exit 0
 fi
 
-sudo virsh destroy ${DISTRO}_xci_vm || true
-sudo virsh undefine ${DISTRO}_xci_vm || true
+sudo virsh destroy $VM_NAME || true
+sudo virsh undefine $VM_NAME || true
index a92e490..11db4e1 100644 (file)
           recipients: fatih.degirmenci@ericsson.com yroblamo@redhat.com mchandras@suse.de jack.morgan@intel.com julienjut@gmail.com
       # yamllint enable rule:line-length
       - email-jenkins-admins-on-failure
+      - postbuildscript:
+          script-only-if-succeeded: false
+          script-only-if-failed: false
+          builders:
+            - shell:
+                !include-raw: ./xci-cleanup.sh
 
 - job-template:
     name: 'xci-{phase}-{pod}-{distro}-daily-{stream}'
index 492348d..92eea19 100644 (file)
               kill-phase-on: NEVER
               abort-all-job: true
 
+    publishers:
+      - postbuildscript:
+          script-only-if-succeeded: false
+          script-only-if-failed: false
+          builders:
+            - shell:
+                !include-raw: ./xci-cleanup.sh
+
 - job-template:
     name: 'xci-{phase}-{type}-{distro}-merge-{stream}'
 
     builders:
       - shell:
           !include-raw: ./xci-run-functest.sh
-      - shell:
-          !include-raw: ./xci-cleanup.sh
 
 - builder:
     name: 'xci-merge-promote-macro'
index 98ad7ff..62818ab 100755 (executable)
@@ -14,6 +14,9 @@
 # what you are doing.
 #----------------------------------------------------------------------
 
+# ensure GERRIT_TOPIC is set
+GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+
 # skip the healthcheck if the patch doesn't impact the deployment
 if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
     echo "Skipping the healthcheck!"
index 9bcc469..60b48cf 100755 (executable)
@@ -7,6 +7,9 @@
 # which accompanies this distribution, and is available at
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
+set -o errexit
+set -o nounset
+set -o pipefail
 
 #----------------------------------------------------------------------
 # This script is used by CI and executed by Jenkins jobs.
 # what you are doing.
 #----------------------------------------------------------------------
 
+# ensure GERRIT_TOPIC is set
+GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+
 # skip the healthcheck if the patch doesn't impact the deployment
 if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
     echo "Skipping the healthcheck!"
     exit 0
 fi
 
+# skip the healthcheck if the scenario is Kubernetes scenario
+if [[ "$DEPLOY_SCENARIO" =~ k8 ]]; then
+    echo "Skipping the healthcheck!"
+    exit 0
+fi
+
 # if the scenario is external, we need to wipe WORKSPACE to place releng-xci there since
 # the project where the scenario is coming from is cloned and the patch checked out to the
 # xci/scenarios/$DEPLOY_SCENARIO to be synched on clean VM
index 764857b..62b26c0 100755 (executable)
@@ -8,7 +8,6 @@
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
 set -o errexit
-set -o nounset
 set -o pipefail
 
 #----------------------------------------------------------------------
@@ -17,64 +16,176 @@ set -o pipefail
 # what you are doing.
 #----------------------------------------------------------------------
 
-WORK_DIRECTORY=/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO
-/bin/rm -rf $WORK_DIRECTORY && mkdir -p $WORK_DIRECTORY
+# This function allows developers to specify the impacted scenario by adding
+# the info about installer and scenario into the commit message or using
+# the topic branch names. This results in either skipping the real verification
+# totally or skipping the determining the installer and scenario programmatically.
+# It is important to note that this feature is only available to generic scenarios
+# and only single installer/scenario pair is allowed.
+# The input in commit message should be placed at the end of the commit message body,
+# before the signed-off and change-id lines.
+#
+# Pattern to be searched in Commit Message
+#   deploy-scenario:<scenario-name>
+#   installer-type:<installer-type>
+# Examples:
+#   deploy-scenario:os-odl-nofeature
+#   installer-type:osa
+#
+#   deploy-scenario:k8-nosdn-nofeature
+#   installer-type:kubespray
+#
+# Patterns to be searched in topic branch name
+#   skip-verify
+#   skip-deployment
+#   force-verify
+function override_generic_scenario() {
+    echo "Processing $GERRIT_PROJECT patchset $GERRIT_REFSPEC"
 
-# ensure GERRIT_TOPIC is set
-GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+    # process topic branch names
+    if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
+        # skip the real verification
+        echo "Skipping verify!"
+        echo "INSTALLER_TYPE=osa" > $WORK_DIRECTORY/scenario.properties
+        echo "DEPLOY_SCENARIO=os-nosdn-nofeature" >> $WORK_DIRECTORY/scenario.properties
+        exit 0
+    elif [[ "$GERRIT_TOPIC" =~ 'force-verify' ]]; then
+        # Run the deployment with default installer and scenario when multiple things change
+        # and we want to force that.
+        echo "Recording the installer 'osa' and scenario 'os-nosdn-nofeature' for downstream jobs"
+        echo "Forcing CI verification of default scenario and installer!"
+        echo "INSTALLER_TYPE=osa" > $WORK_DIRECTORY/scenario.properties
+        echo "DEPLOY_SCENARIO=os-nosdn-nofeature" >> $WORK_DIRECTORY/scenario.properties
+        exit 0
+    fi
 
-# skip the healthcheck if the patch doesn't impact the deployment
-if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
-    echo "Skipping verify!"
-    echo "DEPLOY_SCENARIO=os-nosdn-nofeature" > $WORK_DIRECTORY/scenario.properties
-    exit 0
-fi
+    # process commit message
+    if [[ "$GERRIT_CHANGE_COMMIT_MESSAGE" =~ "installer-type:" && "$GERRIT_CHANGE_COMMIT_MESSAGE" =~ "deploy-scenario:" ]]; then
+        INSTALLER_TYPE=$(echo $GERRIT_CHANGE_COMMIT_MESSAGE | awk '/installer-type:/' RS=" " | cut -d":" -f2)
+        DEPLOY_SCENARIO=$(echo $GERRIT_CHANGE_COMMIT_MESSAGE | awk '/deploy-scenario:/' RS=" " | cut -d":" -f2)
+
+        if [[ -z "$INSTALLER_TYPE" || -z "$DEPLOY_SCENARIO" ]]; then
+            echo "Installer type or deploy scenario is not specified. Falling back to programmatically determining them."
+        else
+            echo "Recording the installer '$INSTALLER_TYPE' and scenario '$DEPLOY_SCENARIO' for downstream jobs"
+            echo "INSTALLER_TYPE=$INSTALLER_TYPE" > $WORK_DIRECTORY/scenario.properties
+            echo "DEPLOY_SCENARIO=$DEPLOY_SCENARIO" >> $WORK_DIRECTORY/scenario.properties
+            exit 0
+        fi
+    else
+        echo "Installer type or deploy scenario is not specified. Falling back to programmatically determining them."
+    fi
+}
 
-# if the scenario is external, we need to wipe WORKSPACE to place releng-xci there since
-# the project where the scenario is coming from is cloned and the patch checked out to the
-# xci/scenarios/$DEPLOY_SCENARIO to be synched on clean VM
-# apart from that, we need releng-xci stuff in WORKSPACE for things to function correctly on Jenkins.
-# if the change is coming to releng-xci, we don't need to do anything since the patch is checked
-# out to the WORKSPACE anyways
-if [[ $GERRIT_PROJECT != "releng-xci" ]]; then
+# This function determines the impacted generic scenario by processing the
+# change and using diff to see what changed. If changed files belong to a scenario
+# its name gets recorded for deploying and testing the right scenario.
+#
+# Pattern to be searched in Changeset
+#   releng-xci/scenarios/<scenario>/<impacted files>: <scenario>
+#   releng-xci/xci/installer/osa/<impacted files>: os-nosdn-nofeature
+#   releng-xci/xci/installer/kubespray/<impacted files>: k8-nosdn-nofeature
+#   the rest: os-nosdn-nofeature
+function determine_generic_scenario() {
+    echo "Processing $GERRIT_PROJECT patchset $GERRIT_REFSPEC"
+
+    # get the changeset
+    cd $WORKSPACE
+    CHANGESET=$(git diff HEAD^..HEAD --name-only)
+    for CHANGED_FILE in $CHANGESET; do
+        case $CHANGED_FILE in
+            *k8-nosdn*|*kubespray*)
+                [[ ${DEPLOY_SCENARIO[@]} =~ "k8-nosdn-nofeature" ]] || DEPLOY_SCENARIO[${#DEPLOY_SCENARIO[@]}]='k8-nosdn-nofeature'
+                ;;
+            *os-odl*)
+                [[ ${DEPLOY_SCENARIO[@]} =~ "os-odl-nofeature" ]] || DEPLOY_SCENARIO[${#DEPLOY_SCENARIO[@]}]='os-odl-nofeature'
+                ;;
+            *os-nosdn*|*osa*)
+                [[ ${DEPLOY_SCENARIO[@]} =~ "os-nosdn-nofeature" ]] || DEPLOY_SCENARIO[${#DEPLOY_SCENARIO[@]}]='os-nosdn-nofeature'
+                ;;
+            *)
+                [[ ${DEPLOY_SCENARIO[@]} =~ "os-nosdn-nofeature" ]] || DEPLOY_SCENARIO[${#DEPLOY_SCENARIO[@]}]='os-nosdn-nofeature'
+                ;;
+            esac
+    done
+}
+
+# This function determines the impacted external scenario by processing the Gerrit
+# change and using diff to see what changed. If changed files belong to a scenario
+# its name gets recorded for deploying and testing the right scenario.
+#
+# Pattern
+#   <project-repo>/scenarios/<scenario>/<impacted files>: <scenario>
+function determine_external_scenario() {
+    echo "Processing $GERRIT_PROJECT patchset $GERRIT_REFSPEC"
+
+    # remove the clone that is done via jenkins and place releng-xci there so the
+    # things continue functioning properly
     cd $HOME && /bin/rm -rf $WORKSPACE
-    git clone https://gerrit.opnfv.org/gerrit/releng-xci $WORKSPACE && cd $WORKSPACE
+    git clone -q https://gerrit.opnfv.org/gerrit/releng-xci $WORKSPACE && cd $WORKSPACE
+
+    # fix the permissions so ssh doesn't complain due to having world-readable keyfiles
     chmod -R go-rwx $WORKSPACE/xci/scripts/vm
-fi
 
-# if change is coming to releng-xci, continue as usual until that part is fixed as well
-if [[ $GERRIT_PROJECT == "releng-xci" ]]; then
-    # save the scenario name into java properties file to be injected to downstream jobs via envInject
-    echo "Recording scenario name for downstream jobs"
-    echo "DEPLOY_SCENARIO=os-nosdn-nofeature" > $WORK_DIRECTORY/scenario.properties
-    exit 0
-fi
+    # clone the project repo and fetch the patchset to process for further processing
+    git clone -q https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT $WORK_DIRECTORY/$GERRIT_PROJECT
+    cd $WORK_DIRECTORY/$GERRIT_PROJECT
+    git fetch -q https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT $GERRIT_REFSPEC && git checkout -q FETCH_HEAD
 
-# projects develop different scenarios and jobs need to know which scenario got the
-# change under test so the jobs can deploy and test the right scenario.
-# we need to fetch the change and look at the changeset to find out the scenario instead
-# of hardcoding scenario per project.
+    # process the diff to find out what scenario(s) are impacted - there should only be 1
+    DEPLOY_SCENARIO+=$(git diff HEAD^..HEAD --name-only | grep scenarios | awk -F '[/|/]' '{print $2}' | uniq)
+}
 
-git clone https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT $WORK_DIRECTORY/$GERRIT_PROJECT
-cd $WORK_DIRECTORY/$GERRIT_PROJECT
-git fetch https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT $GERRIT_REFSPEC && git checkout FETCH_HEAD
-DEPLOY_SCENARIO=$(git diff HEAD^..HEAD --name-only | grep scenarios | awk -F '[/|/]' '{print $2}' | uniq)
+echo "Determining the impacted scenario"
+
+declare -a DEPLOY_SCENARIO
+
+# ensure GERRIT_TOPIC is set
+GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+
+# this directory is where the temporary clones and files are created
+# while extracting the impacted scenario
+WORK_DIRECTORY=/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO
+/bin/rm -rf $WORK_DIRECTORY && mkdir -p $WORK_DIRECTORY
+
+if [[ $GERRIT_PROJECT == "releng-xci" ]]; then
+    override_generic_scenario
+    determine_generic_scenario
+else
+    determine_external_scenario
+fi
 
 # ensure single scenario is impacted
-if [[ $(echo $DEPLOY_SCENARIO | wc -w) != 1 ]]; then
+    if [[ $(IFS=$'\n' echo ${DEPLOY_SCENARIO[@]} | wc -w) != 1 ]]; then
     echo "Change impacts multiple scenarios!"
     echo "XCI doesn't support testing of changes that impact multiple scenarios currently."
     echo "Please split your change into multiple different/dependent changes, each modifying single scenario."
     exit 1
 fi
 
-# save the scenario name into java properties file to be injected to downstream jobs via envInject
-echo "Recording scenario name '$DEPLOY_SCENARIO' for downstream jobs"
-echo "DEPLOY_SCENARIO=$DEPLOY_SCENARIO" > $WORK_DIRECTORY/scenario.properties
+# set the installer
+case ${DEPLOY_SCENARIO[0]} in
+    os-*)
+        INSTALLER_TYPE=osa
+        ;;
+    k8-*)
+        INSTALLER_TYPE=kubespray
+        ;;
+    *)
+        echo "Unable to determine the installer. Exiting!"
+        exit 1
+        ;;
+esac
+
+# save the installer and scenario names into java properties file
+# so they can be injected to downstream jobs via envInject
+echo "Recording the installer '$INSTALLER_TYPE' and scenario '${DEPLOY_SCENARIO[0]}' for downstream jobs"
+echo "INSTALLER_TYPE=$INSTALLER_TYPE" > $WORK_DIRECTORY/scenario.properties
+echo "DEPLOY_SCENARIO=$DEPLOY_SCENARIO" >> $WORK_DIRECTORY/scenario.properties
 
 # skip the deployment if the scenario is not supported on this distro
 OPNFV_SCENARIO_REQUIREMENTS=$WORKSPACE/xci/opnfv-scenario-requirements.yml
-if ! sed -n "/^- scenario: $DEPLOY_SCENARIO$/,/^$/p" $OPNFV_SCENARIO_REQUIREMENTS | grep -q $DISTRO; then
-    echo "# SKIPPED: Scenario $DEPLOY_SCENARIO is NOT supported on $DISTRO"
+if ! sed -n "/^- scenario: ${DEPLOY_SCENARIO[0]}$/,/^$/p" $OPNFV_SCENARIO_REQUIREMENTS | grep -q $DISTRO; then
+    echo "# SKIPPED: Scenario ${DEPLOY_SCENARIO[0]} is NOT supported on $DISTRO"
     exit 0
 fi
index 0628829..102ca41 100755 (executable)
@@ -14,6 +14,9 @@
 # what you are doing.
 #----------------------------------------------------------------------
 
+# ensure GERRIT_TOPIC is set
+GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+
 # skip the deployment if the patch doesn't impact the deployment
 if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
     echo "Skipping the deployment!"
index c2f1f99..7874e67 100755 (executable)
@@ -14,6 +14,9 @@
 # what you are doing.
 #----------------------------------------------------------------------
 
+# ensure GERRIT_TOPIC is set
+GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+
 # skip the deployment if the patch doesn't impact the deployment
 if [[ "$GERRIT_TOPIC" =~ 'skip-verify' ]]; then
     echo "Skipping the deployment!"
index c54a1b9..4c9ff9e 100644 (file)
               kill-phase-on: NEVER
               abort-all-job: true
 
+    publishers:
+      - postbuildscript:
+          script-only-if-succeeded: false
+          script-only-if-failed: false
+          builders:
+            - shell:
+                !include-raw: ./xci-cleanup.sh
+
+
 - job-template:
     name: 'xci-verify-{distro}-{phase}-{type}-{stream}'
 
       - string:
           name: OPNFV_RELENG_DEV_PATH
           default: $WORKSPACE/
-      - string:
-          name: INSTALLER_TYPE
-          default: 'osa'
       - string:
           name: GIT_BASE
           default: https://gerrit.opnfv.org/gerrit/$PROJECT
     builders:
       - shell:
           !include-raw: ./xci-run-functest.sh
-      - shell:
-          !include-raw: ./xci-cleanup.sh