Merge "[Compass] Add new scenarios"
authormei mei <meimei@huawei.com>
Tue, 27 Feb 2018 02:48:57 +0000 (02:48 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Tue, 27 Feb 2018 02:48:57 +0000 (02:48 +0000)
12 files changed:
jjb/compass4nfv/compass-ci-jobs.yml
jjb/dovetail/dovetail-run.sh
jjb/functest/functest-daily-jobs.yml
jjb/global/releng-macros.yml
jjb/releng/opnfv-utils.yml
jjb/xci/xci-run-functest.sh
jjb/xci/xci-set-scenario.sh [new file with mode: 0755]
jjb/xci/xci-start-deployment.sh
jjb/xci/xci-start-new-vm.sh
jjb/xci/xci-verify-jobs.yml
utils/build-server-ansible/vars/docker-compose-CentOS.yml [moved from utils/build-server-ansible/vars/docker-compose-Centos.yml with 100% similarity]
utils/slave-monitor-0.1.sh [changed mode: 0644->0755]

index d38a67b..1cf81a1 100644 (file)
           installer: '{installer}'
           gs-pathname: '{gs-pathname}'
           ppa-pathname: '{ppa-pathname}'
-      - string:
-          name: DEPLOY_SCENARIO
-          default: '{scenario}'
       - '{slave-label}-defaults'
       - '{installer}-defaults'
 
           name: LOG_DIRECTORY
           default: $WORKSPACE/log_output
           description: "Directory where the logs will be located upon the completion of the collection."
+      - string:
+          name: DEPLOY_SCENARIO
+          default: 'os-nosdn-nofeature-ha'
+          description: "Scenario to deploy with."
+      - string:
+          name: COMPASS_OS_VERSION
+          default: ''
+      - string:
+          name: COMPASS_OPENSTACK_VERSION
+          default: ''
+
 
 ########################
 # trigger macros
index 451662a..ec879e3 100755 (executable)
@@ -199,6 +199,27 @@ if [[ ! -f ${cirros_image} ]]; then
 fi
 sudo cp ${cirros_image} ${DOVETAIL_CONFIG}
 
+# snaps_smoke test case needs to download this image first before running
+ubuntu14_image=${image_path}/ubuntu-14.04-server-cloudimg-amd64-disk1.img
+if [[ ! -f ${ubuntu14_image} ]]; then
+    echo "Download image ubuntu-14.04-server-cloudimg-amd64-disk1.img ..."
+    wget -q -nc https://cloud-images.ubuntu.com/releases/14.04/release/ubuntu-14.04-server-cloudimg-amd64-disk1.img -P ${image_path}
+fi
+sudo cp ${ubuntu14_image} ${DOVETAIL_CONFIG}
+
+# cloudify_ims test case needs to download these 2 images first before running
+cloudify_image=${image_path}/cloudify-manager-premium-4.0.1.qcow2
+if [[ ! -f ${cloudify_image} ]]; then
+    echo "Download image cloudify-manager-premium-4.0.1.qcow2 ..."
+    wget -q -nc http://repository.cloudifysource.org/cloudify/4.0.1/sp-release/cloudify-manager-premium-4.0.1.qcow2 -P ${image_path}
+fi
+sudo cp ${cloudify_image} ${DOVETAIL_CONFIG}
+trusty_image=${image_path}/trusty-server-cloudimg-amd64-disk1.img
+if [[ ! -f ${trusty_image} ]]; then
+    echo "Download image trusty-server-cloudimg-amd64-disk1.img ..."
+    wget -q -nc http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img -P ${image_path}
+fi
+sudo cp ${trusty_image} ${DOVETAIL_CONFIG}
 
 opts="--privileged=true -id"
 
@@ -238,18 +259,6 @@ if [ $(docker ps | grep "${DOCKER_REPO}:${DOCKER_TAG}" | wc -l) == 0 ]; then
     exit 1
 fi
 
-if [[ ! "${SUT_BRANCH}" =~ "danube" && ${INSTALLER_TYPE} == 'fuel' && ${DEPLOY_TYPE} == 'baremetal' ]]; then
-    source_cmd="source ${OPENRC}"
-    get_public_url_cmd="openstack --insecure endpoint list --service keystone --interface public | sed -n 4p | awk '{print \$14}'"
-    public_url=$(sudo docker exec "$container_id" /bin/bash -c "${source_cmd} && ${get_public_url_cmd}")
-    sed -i 's#OS_AUTH_URL=.*#OS_AUTH_URL='"${public_url}"'#g' ${OPENRC}
-    sed -i 's/internal/public/g' ${OPENRC}
-    if [[ ${public_url} =~ 'v2' ]]; then
-        sed -i "s/OS_IDENTITY_API_VERSION=3/OS_IDENTITY_API_VERSION=2.0/g" ${OPENRC}
-    fi
-    cat ${OPENRC}
-fi
-
 # Modify tempest_conf.yaml file
 tempest_conf_file=${DOVETAIL_CONFIG}/tempest_conf.yaml
 if [[ ${INSTALLER_TYPE} == 'compass' || ${INSTALLER_TYPE} == 'apex' ]]; then
index 0f1ac35..099d01a 100644 (file)
     #       <<: *master
     # -------------------------------
 
-    functest-tier:
-      - 'healthcheck':
-          job-timeout: 20
-      - 'smoke':
-          job-timeout: 180
-      - 'components':
-          job-timeout: 240
-      - 'vnf':
-          job-timeout: 240
-
-    features-suite:
-      - 'doctor-notification'
-      - 'promise'
-      - 'bgpvpn'
-      - 'functest-odl-sfc'
-      - 'domino-multinode'
-      - 'fds'
-      - 'barometercollectd'
-
-    exclude:
-      - features-suite: 'promise'
-        stream: 'master'
-      - features-suite: 'domino-multinode'
-        stream: 'master'
-      - features-suite: 'fds'
-        stream: 'euphrates'
-
-    build-job-settings: &build-job-settings
-      current-parameter: false
-      git-revision: true
-      node-parameters: false
-      kill-phase-on: FAILURE
-      abort-all-jobs: false
-      predefined-parameters: |
-        FUNCTEST_MODE=$FUNCTEST_MODE
-        FUNCTEST_TIER=$FUNCTEST_TIER
-
-    features-job-settings: &features-job-settings
-      current-parameter: false
-      git-revision: true
-      node-parameters: false
-      kill-phase-on: FAILURE
-      abort-all-jobs: false
-      predefined-parameters: |
-        FUNCTEST_MODE=$FUNCTEST_MODE
-        FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME
+    testsuite:
+      - 'suite':
+          job-timeout: 60
+      - 'daily':
+          job-timeout: 300
+      - 'arm-daily':
+          job-timeout: 300
 
     jobs:
-      - 'functest-{installer}-{pod}-suite-{stream}'
-      - 'functest-{installer}-{pod}-daily-{stream}'
-      - 'functest-{installer}-{pod}-daily-{functest-tier}-{stream}'
-      - 'functest-{installer}-{pod}-daily-features-{features-suite}-{stream}'
+      - 'functest-{installer}-{pod}-{testsuite}-{stream}'
+
 ################################
 # job template
 ################################
 - job-template:
-
-    name: 'functest-{installer}-{pod}-daily-{stream}'
-
-    project-type: multijob
-
-    disabled: '{obj:disabled}'
-
-    parameters:
-      - project-parameter:
-          project: '{project}'
-          branch: '{branch}'
-      - '{installer}-defaults'
-      - '{slave-label}-defaults'
-      - functest-parameter:
-          gs-pathname: '{gs-pathname}'
-
-    builders:
-      - multijob:
-          name: 'Run functest tests'
-          execution-type: SEQUENTIAL
-          projects:
-            - name: 'functest-{installer}-{pod}-daily-healthcheck-{stream}'
-              <<: *build-job-settings
-            - name: 'functest-{installer}-{pod}-daily-smoke-{stream}'
-              <<: *build-job-settings
-            - name: 'functest-{installer}-{pod}-daily-vnf-{stream}'
-              <<: *build-job-settings
-            - name: 'functest-{installer}-{pod}-daily-features-doctor-notification-{stream}'
-              <<: *features-job-settings
-            - name: 'functest-{installer}-{pod}-daily-features-bgpvpn-{stream}'
-              <<: *features-job-settings
-            - name: 'functest-{installer}-{pod}-daily-features-functest-odl-sfc-{stream}'
-              <<: *features-job-settings
-            - name: 'functest-{installer}-{pod}-daily-features-barometercollectd-{stream}'
-              <<: *features-job-settings
-            - name: 'functest-{installer}-{pod}-daily-features-fds-{stream}'
-              <<: *features-job-settings
-            - name: 'functest-{installer}-{pod}-daily-features-promise-{stream}'
-              <<: *features-job-settings
-            - name: 'functest-{installer}-{pod}-daily-features-domino-multinode-{stream}'
-              <<: *features-job-settings
-
-- job-template: &functest-installer-tier-job
-
-    name: 'functest-{installer}-{pod}-daily-{functest-tier}-{stream}'
+    name: 'functest-{installer}-{pod}-{testsuite}-{stream}'
 
     concurrent: true
 
           branch: '{branch}'
       - '{installer}-defaults'
       - '{slave-label}-defaults'
-      - string:
-          name: FUNCTEST_MODE
-          default: 'tier'
-      - string:
-          name: FUNCTEST_TIER
-          default: '{functest-tier}'
+      - 'functest-{testsuite}-parameter'
       - string:
           name: DEPLOY_SCENARIO
-          default: 'os-nosdn-nofeature-noha'
+          default: 'os-odl_l2-nofeature-ha'
       - string:
           name: CLEAN_DOCKER_IMAGES
           default: 'false'
     builders:
       - description-setter:
           description: "Built on $NODE_NAME"
-      - 'functest-daily-builder'
-
-    publishers:
-      - 'functest-recipients'
-      - 'fuel-recipients'
-
-- job-template:
-
-    name: 'functest-{installer}-{pod}-suite-{stream}'
-    <<: *functest-installer-tier-job
-
-    wrappers:
-      - build-name:
-          name: '$BUILD_NUMBER Suite: $FUNCTEST_MODE Scenario: $DEPLOY_SCENARIO'
-      - timeout:
-          timeout: '60'
-          abort: true
-    parameters:
-      - project-parameter:
-          project: '{project}'
-          branch: '{branch}'
-      - '{installer}-defaults'
-      - '{slave-label}-defaults'
-      - 'functest-suite-parameter'
-      - string:
-          name: DEPLOY_SCENARIO
-          default: 'os-nosdn-nofeature-noha'
-      - string:
-          name: CLEAN_DOCKER_IMAGES
-          default: 'false'
-          description: 'Remove downloaded docker images (opnfv/functest*:*)'
-      - functest-parameter:
-          gs-pathname: '{gs-pathname}'
-
-    builders:
-      - description-setter:
-          description: "Built on $NODE_NAME"
-      - 'functest-suite-builder'
-
-- job-template:
-
-    name: 'functest-{installer}-{pod}-daily-features-{features-suite}-{stream}'
-    concurrent: true
-    properties:
-      - logrotate-default
-      - throttle:
-          enabled: true
-          max-per-node: 1
-          option: 'project'
-    wrappers:
-      - build-name:
-          name: '$BUILD_NUMBER Suite: $FUNCTEST_MODE Scenario: $DEPLOY_SCENARIO'
-
-    parameters:
-      - project-parameter:
-          project: '{project}'
-          branch: '{branch}'
-      - '{installer}-defaults'
-      - '{slave-label}-defaults'
-      - string:
-          name: FUNCTEST_MODE
-          default: 'testcase'
-      - string:
-          name: FUNCTEST_SUITE_NAME
-          default: '{features-suite}'
-      - string:
-          name: DEPLOY_SCENARIO
-          default: 'os-nosdn-nofeature-noha'
-      - string:
-          name: CLEAN_DOCKER_IMAGES
-          default: 'false'
-          description: 'Remove downloaded docker images (opnfv/functest*:*)'
-      - functest-parameter:
-          gs-pathname: '{gs-pathname}'
-
-    scm:
-      - git-scm
-
-    builders:
-      - description-setter:
-          description: "Built on $NODE_NAME"
-      - 'functest-daily-builder'
-
-    publishers:
-      - 'functest-features-recipients'
-      - 'functest-recipients'
-      - 'fuel-recipients'
+      - 'functest-{testsuite}-builder'
 
 
 ########################
           default: 'daily'
           description: "Daily suite name to run"
 
+- parameter:
+    name: functest-arm-daily-parameter
+    parameters:
+      - string:
+          name: FUNCTEST_MODE
+          default: 'arm-daily'
+          description: "Daily suite name (Aarch64) to run"
+
 - parameter:
     name: functest-suite-parameter
     parameters:
       - 'functest-store-results'
       - 'functest-exit'
 
+- builder:
+    name: functest-arm-daily-builder
+    builders:
+      - 'functest-cleanup'
+      - 'functest-arm-daily'
+      - 'functest-store-results'
+      - 'functest-exit'
+
 - builder:
     name: functest-suite-builder
     builders:
                     - ../../utils/fetch_k8_conf.sh
                     - ./functest-k8.sh
 
+# yamllint enable rule:indentation
+- builder:
+    name: functest-arm-daily
+    builders:
+      # yamllint disable rule:indentation
+      - shell:
+          !include-raw:
+              - ./functest-env-presetup.sh
+              - ../../utils/fetch_os_creds.sh
+              - ./functest-alpine.sh
+
 # yamllint enable rule:indentation
 - builder:
     name: functest-store-results
     builders:
       - shell:
           !include-raw: ./functest-exit.sh
-
-
-- publisher:
-    name: 'functest-features-recipients'
-    publishers:
-      - email:
-          recipients:
-
-- publisher:
-    name: 'functest-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
-            delia.popescu@enea.com cristina.pauna@enea.com
-            valentin.boucher@kontron.com
-      - email-jenkins-admins-on-failure
-
-- publisher:
-    name: 'fuel-recipients'
-    publishers:
-      - email:
-          recipients: >
-            peter.barabas@ericsson.com mpolenchuck@mirantis.com
-            alexandru.avadanii@enea.com guillermo.herrero@enea.com
index e58e1cf..3433cee 100644 (file)
             - shell:
                 !include-raw-escape: installer-report.sh
       - postbuildscript:
+          script-only-if-succeeded: false
           script-only-if-failed: true
           builders:
             - shell: |
index 93b3615..fb3bab4 100644 (file)
@@ -89,7 +89,6 @@
     name: 'check-status-of-slaves'
 
     disabled: false
-
     concurrent: true
 
     parameters:
           name: SLAVE_NAME
           description: 'script lives on master node'
           default-slaves:
-            - master
+            - lf-build1
           allowed-multiselect: false
           ignore-offline-nodes: true
+      - project-parameter:
+          project: releng
+          branch: master
+
+    scm:
+      - git-scm
 
     triggers:
       - timed: '@midnight'
 
     builders:
       - shell: |
-          cd /opt/jenkins-ci/slavemonitor
-          bash slave-monitor-0.1.sh | sort
+          cd $WORKSPACE/utils/
+          bash slave-monitor-0.1.sh
 
 - job-template:
     name: 'ansible-build-server'
     builders:
       - shell: |
           # run playbook
-          sudo ansible-playbook -C -D -i \
+          sudo ansible-playbook -i \
           $WORKSPACE/utils/build-server-ansible/inventory.ini \
           $WORKSPACE/utils/build-server-ansible/main.yml
 
index b2421de..39d4ea1 100755 (executable)
@@ -20,6 +20,18 @@ if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
     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
+# 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
+    cd $HOME && /bin/rm -rf $WORKSPACE
+    git clone https://gerrit.opnfv.org/gerrit/releng-xci $WORKSPACE && cd $WORKSPACE
+    chmod -R go-rwx $WORKSPACE/xci/scripts/vm
+fi
+
 # 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
diff --git a/jjb/xci/xci-set-scenario.sh b/jjb/xci/xci-set-scenario.sh
new file mode 100755 (executable)
index 0000000..4fffafb
--- /dev/null
@@ -0,0 +1,78 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# 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.
+# You are not supposed to use this script manually if you don't know
+# 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
+
+# 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
+    cd $HOME && /bin/rm -rf $WORKSPACE
+    git clone https://gerrit.opnfv.org/gerrit/releng-xci $WORKSPACE && cd $WORKSPACE
+    chmod -R go-rwx $WORKSPACE/xci/scripts/vm
+fi
+
+WORK_DIRECTORY=/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO
+/bin/rm -rf $WORK_DIRECTORY && mkdir -p $WORK_DIRECTORY
+
+# 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
+
+# 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.
+
+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 | sed -r 's/scenarios\/(.*?)\/.*/\1/' | uniq)
+
+# ensure single scenario is impacted
+if [[ $(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
+
+# 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"
+    exit 0
+fi
index e86f5b3..cb75b51 100755 (executable)
@@ -20,6 +20,18 @@ if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
     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
+# 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
+    cd $HOME && /bin/rm -rf $WORKSPACE
+    git clone https://gerrit.opnfv.org/gerrit/releng-xci $WORKSPACE && cd $WORKSPACE
+    chmod -R go-rwx $WORKSPACE/xci/scripts/vm
+fi
+
 # 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
index 2c6ec3f..d676e26 100755 (executable)
@@ -20,6 +20,18 @@ if [[ "$GERRIT_TOPIC" =~ 'skip-verify' ]]; then
     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
+# 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
+    cd $HOME && /bin/rm -rf $WORKSPACE
+    git clone https://gerrit.opnfv.org/gerrit/releng-xci $WORKSPACE && cd $WORKSPACE
+    chmod -R go-rwx $WORKSPACE/xci/scripts/vm
+fi
+
 # 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
@@ -35,6 +47,7 @@ cd $WORKSPACE
 # yourself.
 cat > xci_test.sh<<EOF
 #!/bin/bash
+set -o pipefail
 export DISTRO=$DISTRO
 export DEPLOY_SCENARIO=$DEPLOY_SCENARIO
 export FUNCTEST_MODE=$FUNCTEST_MODE
index c6b6bc4..3902e8e 100644 (file)
                 comment-contains-value: 'reverify'
           projects:
             - project-compare-type: 'ANT'
-              project-pattern: '{project}'
+              project-pattern: 'releng-xci'
               branches:
                 - branch-compare-type: 'ANT'
                   branch-pattern: '**/{branch}'
               forbidden-file-paths:
                 - compare-type: ANT
                   pattern: 'xci/scripts/vm/**'
+            - project-compare-type: 'REG_EXP'
+              project-pattern: 'sfc|bgpvpn'
+              branches:
+                - branch-compare-type: 'ANT'
+                  branch-pattern: '**/{branch}'
+              disable-strict-forbidden-file-verification: 'true'
+              file-paths:
+                - compare-type: ANT
+                  pattern: 'scenarios/**'
           readable-message: true
           custom-url: '* $JOB_NAME $BUILD_URL'
           skip-vote:
 
     parameters:
       - project-parameter:
-          project: '{project}'
+          project: $GERRIT_PROJECT
           branch: '{branch}'
       - label:
           name: SLAVE_LABEL
           default: 'xci-virtual'
+      - string:
+          name: DISTRO
+          default: '{distro}'
       - string:
           name: CLEAN_DIB_IMAGES
           default: 'true'
           description: 'Git URL to use on this Jenkins Slave'
 
     builders:
+      - 'xci-verify-set-scenario-macro'
+      - inject:
+          properties-file: "/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO/scenario.properties"
       - description-setter:
-          description: "Built on $NODE_NAME"
+          description: "Scenario: $DEPLOY_SCENARIO | Node: $NODE_NAME"
       - multijob:
           name: deploy
           condition: SUCCESSFUL
               current-parameters: true
               predefined-parameters: |
                 DISTRO={distro}
-                DEPLOY_SCENARIO=os-nosdn-nofeature
                 CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
+                GERRIT_PROJECT=$GERRIT_PROJECT
                 GERRIT_BRANCH=$GERRIT_BRANCH
                 GERRIT_REFSPEC=$GERRIT_REFSPEC
                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
               current-parameters: true
               predefined-parameters: |
                 DISTRO={distro}
-                DEPLOY_SCENARIO=os-nosdn-nofeature
                 CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
-                FUNCTEST_MODE=tier
-                FUNCTEST_TIER=healthcheck
+                GERRIT_PROJECT=$GERRIT_PROJECT
                 GERRIT_BRANCH=$GERRIT_BRANCH
                 GERRIT_REFSPEC=$GERRIT_REFSPEC
                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
                 GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
+                FUNCTEST_MODE=tier
+                FUNCTEST_TIER=healthcheck
               node-parameters: true
               kill-phase-on: NEVER
               abort-all-job: true
     parameters:
       - string:
           name: PROJECT
-          default: 'releng-xci'
+          default: $GERRIT_PROJECT
       - string:
           name: DISTRO
           default: 'ubuntu'
-      - string:
-          name: DEPLOY_SCENARIO
-          default: 'os-nosdn-nofeature'
       - string:
           name: FUNCTEST_MODE
           default: 'tier'
           description: 'Git URL to use on this Jenkins Slave'
 
     wrappers:
+      - inject:
+          properties-file: "/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO/scenario.properties"
       - ssh-agent-wrapper
       - build-timeout:
           timeout: 240
 
     builders:
       - description-setter:
-          description: "Built on $NODE_NAME"
+          description: "Scenario: $DEPLOY_SCENARIO | Node: $NODE_NAME"
       - 'xci-verify-{phase}-macro'
 
 # -------------------------------
 # builder macros
 # -------------------------------
+- builder:
+    name: 'xci-verify-set-scenario-macro'
+    builders:
+      - shell:
+          !include-raw: ./xci-set-scenario.sh
+
 - builder:
     name: 'xci-verify-deploy-macro'
     builders:
old mode 100644 (file)
new mode 100755 (executable)
index 161aaef..5201f93
@@ -8,9 +8,8 @@
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
 
-#This will put a bunch of files in the pwd. you have been warned.
 #Counts how long slaves have been online or offline
-
+#exec 2>/dev/null
 
 #Yes I know about jq
 curlcommand() {
@@ -25,74 +24,66 @@ curl -s "https://build.opnfv.org/ci/computer/api/json?tree=computer\[displayName
     | sed s,\",,g
 }
 
-if [ -f podoutput-current ]; then
-  cp podoutput-current podoutput-lastiteration
-fi
-
-curlcommand > podoutput-current
+curlcommand > /tmp/podoutput-current
 
-declare -A slavescurrent slaveslastiteration
+declare -A slavescurrent
 
 while read -r name status ; do
             slavescurrent["$name"]="$status"
-done < <(cat podoutput-current)
-
-while read -r name status ; do
-            slaveslastiteration["$name"]=$status
-done < <(cat podoutput-lastiteration)
-
+done < <(cat /tmp/podoutput-current)
+
+#haste bin stopped allowing post :(
+#files=(*online)
+#for ((i=0; i<${#files[@]}; i+=9)); do
+#./eplot -d -r [-1:74][-1:30] -m    ${files[i]} ${files[i+1]} ${files[i+2]} ${files[i+3]} ${files[i+4]} ${files[i+5]}  ${files[i+6]} ${files[i+7]} ${files[i+8]} ${files[i+9]}
+#done  | ./haste.bash
+##
 main () {
+
 for slavename in "${!slavescurrent[@]}"; do
-    #Slave is online. Mark it down.
+
+  #Slave is online. Mark it down.
     if [ "${slavescurrent[$slavename]}" == "false" ]; then
 
-        if  [ -f "$slavename"-offline ]; then
-            echo "removing offline status from $slavename slave was offline for $(cat "$slavename"-offline ) iterations"
-            rm "$slavename"-offline
-        fi
-
-        if  ! [ -f "$slavename"-online ]; then
-            echo "1" > "$slavename"-online
-        elif [ -f "$slavename"-online ]; then
-            #read and increment slavename
-            read -r -d $'\x04' var < "$slavename"-online
-            ((var++))
-            echo -n "ONLINE $slavename "
-            echo "for $var iterations"
-            echo "$var" > "$slavename"-online
-        fi
-    fi
+      if  ! [ -f /tmp/"$slavename"-online ]; then
+        echo "1" > /tmp/"$slavename"-online
+                echo "new online slave file created $slavename ${slavescurrent[$slavename]} up for 1 iterations"
+          fi
 
-    #went offline since last iteration.
-    if [ "${slavescurrent[$slavename]}" == "false" ] && [ "${slaveslastiteration[$slavename]}" == "true" ];  then
-        echo "JUST WENT OFFLINE $slavename "
-        if  [ -f "$slavename"-online ]; then
-            echo "removing online status from $slavename. slave was online for $(cat "$slavename"-online ) iterations"
-            rm "$slavename"-online
-        fi
+                #read and increment slavename
+                var="$(cat /tmp/"$slavename"-online |tail -n 1)"
+                if [[ "$var" == "0" ]]; then
+                    echo "slave $slavename ${slavescurrent[$slavename]} back up for $var iterations"
+                fi
+                ((var++))
+                echo "$var" >> /tmp/"$slavename"-online
+                unset var
+                echo "$slavename up $(cat /tmp/$slavename-online | tail -n 10 | xargs)"
 
     fi
 
-    #slave is offline
+    #slave is offline remove all points
     if [ "${slavescurrent[$slavename]}" == "true" ]; then
-        if  ! [ -f "$slavename"-offline ]; then
-            echo "1" > "$slavename"-offline
-        fi
-
-        if [ -f "$slavename"-offline ]; then
-            #read and increment slavename
-            read -r -d $'\x04' var < "$slavename"-offline
-            ((var++))
-            echo "$var" > "$slavename"-offline
-                if  [ "$var" -gt "30" ]; then
-                    echo "OFFLINE FOR $var ITERATIONS REMOVE $slavename "
-                else
-                    echo "OFFLINE $slavename FOR $var ITERATIONS "
-                fi
-        fi
+      if  ! [ -f /tmp/"$slavename"-online ]; then
+        echo "0" > /tmp/"$slavename"-online
+                echo "new offline slave file created $slavename ${slavescurrent[$slavename]} up for 0 iterations"
+
+          fi
+          var="$(cat /tmp/"$slavename"-online |tail -n 1)"
+
+            if [[ "$var" != "0" ]]; then
+                    echo "slave $slavename ${slavescurrent[$slavename]} was up for $var iterations"
+                echo "slave $slavename ${slavescurrent[$slavename]} has gone offline, was $var iterations now reset to 0"
+            fi
+
+        echo "0" >> /tmp/"$slavename"-online
+            echo "$slavename down $(cat /tmp/$slavename-online | tail -n 10 | xargs)"
+            unset var
+
     fi
 
+
 done
 }
 
-main
+main | sort | column -t