Merge "Revert "Remove GIT_BASE parameter from slave parameters""
authorAric Gardner <agardner@linuxfoundation.org>
Fri, 12 Aug 2016 19:33:18 +0000 (19:33 +0000)
committerGerrit Code Review <gerrit@172.30.200.206>
Fri, 12 Aug 2016 19:33:18 +0000 (19:33 +0000)
20 files changed:
jjb/apex/apex-deploy.sh
jjb/apex/apex.yml
jjb/armband/armband-ci-jobs.yml
jjb/armband/build.sh
jjb/compass4nfv/compass-ci-jobs.yml
jjb/fuel/fuel-download-artifact.sh
jjb/functest/functest-ci-jobs.yml
jjb/joid/joid-ci-jobs.yml
jjb/kvmfornfv/kvmfornfv-test.sh
jjb/multisite/multisite.yml
jjb/releng-macros.yaml
jjb/yardstick/yardstick-daily.sh
prototypes/bifrost/.gitkeep [new file with mode: 0644]
prototypes/puppet-infracloud/.gitkeep [new file with mode: 0644]
utils/test/reporting/functest/reporting-status.py
utils/test/reporting/functest/reportingConf.py
utils/test/reporting/functest/testCase.py
utils/test/result_collection_api/update/README.md
utils/test/result_collection_api/update/templates/rm_images.sh [new file with mode: 0755]
utils/test/result_collection_api/update/update.yml

index c6cfb26..24ed848 100755 (executable)
@@ -72,6 +72,7 @@ if [[ "$BUILD_DIRECTORY" == *verify* ]]; then
     DEPLOY_SETTINGS_DIR="${WORKSPACE}/config/deploy"
     NETWORK_SETTINGS_DIR="${WORKSPACE}/config/network"
     DEPLOY_CMD="$(pwd)/deploy.sh"
+    UTIL_CMD="$(pwd)/util.sh"
     RESOURCES="${WORKSPACE}/build/images/"
     CONFIG="${WORKSPACE}/build"
     LIB="${WORKSPACE}/lib"
@@ -129,6 +130,7 @@ else
 
     DEPLOY_CMD=opnfv-deploy
     DEPLOY_SETTINGS_DIR="/etc/opnfv-apex/"
+    UTIL_CMD=opnfv-util
     NETWORK_SETTINGS_DIR="/etc/opnfv-apex/"
     RESOURCES="/var/opt/opnfv/images"
     CONFIG="/var/opt/opnfv"
@@ -137,6 +139,7 @@ fi
 
 # set env vars to deploy cmd
 DEPLOY_CMD="CONFIG=${CONFIG} RESOURCES=${RESOURCES} LIB=${LIB} ${DEPLOY_CMD}"
+UTIL_CMD="CONFIG=${CONFIG} RESOURCES=${RESOURCES} LIB=${LIB} ${UTIL_CMD}"
 
 if [ "$OPNFV_CLEAN" == 'yes' ]; then
   if [[ "$BUILD_DIRECTORY" == *verify* ]]; then
@@ -190,8 +193,12 @@ if ! sudo test -e "$NETWORK_FILE"; then
   exit 1
 fi
 
+# mock detached state for deploy
+sudo $UTIL_CMD mock-detached on
 # start deployment
 sudo ${DEPLOY_CMD} -d ${DEPLOY_FILE} -n ${NETWORK_FILE} --debug
+# turn of mock detached state
+sudo $UTIL_CMD mock-detached off
 
 echo
 echo "--------------------------------------------------------"
index da9089c..1655dc4 100644 (file)
                 build-step-failure-threshold: 'never'
                 failure-threshold: 'never'
                 unstable-threshold: 'FAILURE'
-        - trigger-builds:
-          - project: 'apex-deploy-baremetal-os-nosdn-fdio-noha-{stream1}'
-            predefined-parameters: |
-              BUILD_DIRECTORY=apex-build-{stream1}/build
-              OPNFV_CLEAN=yes
-            git-revision: true
-            same-node: true
-            block-thresholds:
-                build-step-failure-threshold: 'never'
-            block: true
-        - trigger-builds:
-          - project: 'functest-apex-{daily-slave}-daily-{stream1}'
-            predefined-parameters:
-              DEPLOY_SCENARIO=os-nosdn-fdio-noha
-            block: true
-            same-node: true
-            block-thresholds:
-                build-step-failure-threshold: 'never'
-                failure-threshold: 'never'
-                unstable-threshold: 'FAILURE'
-        - trigger-builds:
-          - project: 'yardstick-apex-{slave}-daily-{stream1}'
-            predefined-parameters:
-              DEPLOY_SCENARIO=os-nosdn-fdio-noha
-            block: true
-            same-node: true
-            block-thresholds:
-                build-step-failure-threshold: 'never'
-                failure-threshold: 'never'
-                unstable-threshold: 'FAILURE'
         - trigger-builds:
           - project: 'apex-deploy-virtual-os-nosdn-nofeature-ha-ipv6-{stream1}'
             predefined-parameters: |
index 9d7c198..03c1fb0 100644 (file)
     scenario:
         # HA scenarios
         - 'os-nosdn-nofeature-ha':
-            auto-trigger-name: 'daily-trigger-disabled'
+            auto-trigger-name: 'armband-{scenario}-{pod}-{stream}-trigger'
         - 'os-odl_l2-nofeature-ha':
             auto-trigger-name: 'armband-{scenario}-{pod}-{stream}-trigger'
         - 'os-odl_l3-nofeature-ha':
-            auto-trigger-name: 'daily-trigger-disabled'
+            auto-trigger-name: 'armband-{scenario}-{pod}-{stream}-trigger'
         - 'os-odl_l2-bgpvpn-ha':
-            auto-trigger-name: 'daily-trigger-disabled'
+            auto-trigger-name: 'armband-{scenario}-{pod}-{stream}-trigger'
 
         # NOHA scenarios
         - 'os-odl_l2-nofeature-noha':
-            auto-trigger-name: 'daily-trigger-disabled'
+            auto-trigger-name: 'armband-{scenario}-{pod}-{stream}-trigger'
 
     jobs:
         - 'armband-{scenario}-{pod}-daily-{stream}'
 #----------------------------------------------------------
 # Enea Armband POD 1 Triggers running against master branch
 #----------------------------------------------------------
-# No triggers for master for now
 - trigger:
     name: 'armband-os-odl_l2-nofeature-ha-arm-pod1-master-trigger'
     triggers:
-        - timed: ''
+        - timed: '0 3 * * 1,4'
+- trigger:
+    name: 'armband-os-nosdn-nofeature-ha-arm-pod1-master-trigger'
+    triggers:
+        - timed: '0 15 * * 1,4'
+- trigger:
+    name: 'armband-os-odl_l3-nofeature-ha-arm-pod1-master-trigger'
+    triggers:
+        - timed: '0 3 * * 2,5'
+- trigger:
+    name: 'armband-os-odl_l2-bgpvpn-ha-arm-pod1-master-trigger'
+    triggers:
+        - timed: '0 15 * * 2,5'
+- trigger:
+    name: 'armband-os-odl_l2-nofeature-noha-arm-pod1-master-trigger'
+    triggers:
+        - timed: '0 3 * * 3,6'
 #---------------------------------------------------------------
 # Enea Armband POD 1 Triggers running against brahmaputra branch
 #---------------------------------------------------------------
     name: 'armband-os-odl_l2-nofeature-ha-arm-pod1-brahmaputra-trigger'
     triggers:
         - timed: ''
+- trigger:
+    name: 'armband-os-nosdn-nofeature-ha-arm-pod1-brahmaputra-trigger'
+    triggers:
+        - timed: ''
+- trigger:
+    name: 'armband-os-odl_l3-nofeature-ha-arm-pod1-brahmaputra-trigger'
+    triggers:
+        - timed: ''
+- trigger:
+    name: 'armband-os-odl_l2-bgpvpn-ha-arm-pod1-brahmaputra-trigger'
+    triggers:
+        - timed: ''
+- trigger:
+    name: 'armband-os-odl_l2-nofeature-noha-arm-pod1-brahmaputra-trigger'
+    triggers:
+        - timed: ''
 #----------------------------------------------------------
 # Enea Armband POD 2 Triggers running against master branch
 #----------------------------------------------------------
     name: 'armband-os-odl_l2-nofeature-ha-arm-pod2-master-trigger'
     triggers:
         - timed: ''
+- trigger:
+    name: 'armband-os-nosdn-nofeature-ha-arm-pod2-master-trigger'
+    triggers:
+        - timed: ''
+- trigger:
+    name: 'armband-os-odl_l3-nofeature-ha-arm-pod2-master-trigger'
+    triggers:
+        - timed: ''
+- trigger:
+    name: 'armband-os-odl_l2-bgpvpn-ha-arm-pod2-master-trigger'
+    triggers:
+        - timed: ''
+- trigger:
+    name: 'armband-os-odl_l2-nofeature-noha-arm-pod2-master-trigger'
+    triggers:
+        - timed: ''
 #---------------------------------------------------------------
 # Enea Armband POD 2 Triggers running against brahmaputra branch
 #---------------------------------------------------------------
     name: 'armband-os-odl_l2-nofeature-ha-arm-pod2-brahmaputra-trigger'
     triggers:
         - timed: ''
+- trigger:
+    name: 'armband-os-nosdn-nofeature-ha-arm-pod2-brahmaputra-trigger'
+    triggers:
+        - timed: ''
+- trigger:
+    name: 'armband-os-odl_l3-nofeature-ha-arm-pod2-brahmaputra-trigger'
+    triggers:
+        - timed: ''
+- trigger:
+    name: 'armband-os-odl_l2-bgpvpn-ha-arm-pod2-brahmaputra-trigger'
+    triggers:
+        - timed: ''
+- trigger:
+    name: 'armband-os-odl_l2-nofeature-noha-arm-pod2-brahmaputra-trigger'
+    triggers:
+        - timed: ''
index 81917f6..26c46d2 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/bash
+# SPDX-license-identifier: Apache-2.0
 ##############################################################################
 # Copyright (c) 2016 Ericsson AB and others.
+# Copyright (c) 2016 Enea AB.
 # 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
@@ -12,14 +14,49 @@ set -o pipefail
 
 cd $WORKSPACE
 
+# remove the expired items from cache
+test -f $WORKSPACE/ci/clean_cache.sh && $WORKSPACE/ci/clean_cache.sh $CACHE_DIRECTORY
+
+LATEST_ISO_PROPERTIES=$WORKSPACE/latest.iso.properties
+if [[ "$JOB_NAME" =~ "daily" ]]; then
+    # check to see if we already have an artifact on artifacts.opnfv.org
+    # for this commit during daily builds
+    echo "Checking to see if we already built and stored Armband Fuel ISO for this commit"
+
+    curl -s -o $LATEST_ISO_PROPERTIES http://$GS_URL/latest.properties 2>/dev/null
+
+    # get metadata of latest ISO
+    LATEST_ISO_SHA1=$(grep OPNFV_GIT_SHA1 $LATEST_ISO_PROPERTIES | cut -d'=' -f2)
+    LATEST_ISO_URL=$(grep OPNFV_ARTIFACT_URL $LATEST_ISO_PROPERTIES | cut -d'=' -f2)
+else
+    LATEST_ISO_SHA1=none
+fi
+
 # get current SHA1
 CURRENT_SHA1=$(git rev-parse HEAD)
 
+# set FORCE_BUILD to false for non-daily builds
+FORCE_BUILD=${FORCE_BUILD:-false}
+
+if [[ "$CURRENT_SHA1" == "$LATEST_ISO_SHA1" && "$FORCE_BUILD" == "false" ]]; then
+    echo "***************************************************"
+    echo "   An ISO has already been built for this commit"
+    echo "   $LATEST_ISO_URL"
+    echo "***************************************************"
+else
+    echo "This commit has not been built yet or forced build! Proceeding with the build."
+    /bin/rm -f $LATEST_ISO_PROPERTIES
+    echo
+fi
+
 # log info to console
-echo "Starting the build of Armband. This could take some time..."
+echo "Starting the build of Armband $INSTALLER_TYPE. This could take some time..."
 echo "-----------------------------------------------------------"
 echo
 
+# create the cache directory if it doesn't exist
+mkdir -p $CACHE_DIRECTORY
+
 # set OPNFV_ARTIFACT_VERSION
 if [[ "$JOB_NAME" =~ "merge" ]]; then
     echo "Building Fuel ISO for a merged change"
@@ -39,7 +76,7 @@ NOCACHE_ARG=${NOCACHE_ARG:-}
 
 # start the build
 cd $WORKSPACE/ci
-./build.sh $BUILD_DIRECTORY
+./build.sh -v $OPNFV_ARTIFACT_VERSION $NOCACHE_ARG -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
 
 # list the build artifacts
 ls -al $BUILD_DIRECTORY
index bb24fdf..eb30004 100644 (file)
 - trigger:
     name: 'compass-os-nosdn-nofeature-ha-huawei-pod2-master-trigger'
     triggers:
-        - timed: '0 3 * * *'
+        - timed: '0 19 * * *'
 - trigger:
     name: 'compass-os-odl_l2-nofeature-ha-huawei-pod2-master-trigger'
     triggers:
 - trigger:
     name: 'compass-os-odl_l3-nofeature-ha-huawei-pod2-master-trigger'
     triggers:
-        - timed: '0 19 * * *'
+        - timed: '0 15 * * *'
 - trigger:
     name: 'compass-os-onos-nofeature-ha-huawei-pod2-master-trigger'
     triggers:
-        - timed: '0 15 * * *'
+        - timed: ''
 - trigger:
     name: 'compass-os-ocl-nofeature-ha-huawei-pod2-master-trigger'
     triggers:
 - trigger:
     name: 'compass-os-onos-sfc-ha-huawei-pod2-master-trigger'
     triggers:
-        - timed: '0 7 * * *'
+        - timed: ''
 - trigger:
     name: 'compass-os-odl_l2-moon-ha-huawei-pod2-master-trigger'
     triggers:
 - trigger:
     name: 'compass-os-nosdn-nofeature-ha-baremetal-master-trigger'
     triggers:
-        - timed: '0 3 * * *'
+        - timed: '0 2 * * *'
 - trigger:
     name: 'compass-os-odl_l2-nofeature-ha-baremetal-master-trigger'
     triggers:
-        - timed: '0 23 * * *'
+        - timed: '0 22 * * *'
 - trigger:
     name: 'compass-os-odl_l3-nofeature-ha-baremetal-master-trigger'
     triggers:
-        - timed: '0 19 * * *'
+        - timed: '0 18 * * *'
 - trigger:
     name: 'compass-os-onos-nofeature-ha-baremetal-master-trigger'
     triggers:
-        - timed: '0 15 * * *'
+        - timed: '0 14 * * *'
 - trigger:
     name: 'compass-os-ocl-nofeature-ha-baremetal-master-trigger'
     triggers:
-        - timed: '0 11 * * *'
+        - timed: '0 10 * * *'
 - trigger:
     name: 'compass-os-onos-sfc-ha-baremetal-master-trigger'
     triggers:
-        - timed: '0 7 * * *'
+        - timed: '0 6 * * *'
 - trigger:
     name: 'compass-os-odl_l2-moon-ha-baremetal-master-trigger'
     triggers:
 - trigger:
     name: 'compass-os-nosdn-nofeature-ha-virtual-master-trigger'
     triggers:
-        - timed: '0 3 * * *'
+        - timed: '0 21 * * *'
 - trigger:
     name: 'compass-os-odl_l2-nofeature-ha-virtual-master-trigger'
     triggers:
-        - timed: '0 23 * * *'
+        - timed: '0 20 * * *'
 - trigger:
     name: 'compass-os-odl_l3-nofeature-ha-virtual-master-trigger'
     triggers:
 - trigger:
     name: 'compass-os-onos-nofeature-ha-virtual-master-trigger'
     triggers:
-        - timed: '0 15 * * *'
+        - timed: '0 18 * * *'
 - trigger:
     name: 'compass-os-ocl-nofeature-ha-virtual-master-trigger'
     triggers:
-        - timed: '0 11 * * *'
+        - timed: '0 16 * * *'
 - trigger:
     name: 'compass-os-onos-sfc-ha-virtual-master-trigger'
     triggers:
-        - timed: '0 7 * * *'
+        - timed: '0 15 * * *'
 - trigger:
     name: 'compass-os-odl_l2-moon-ha-virtual-master-trigger'
     triggers:
-        - timed: ''
+        - timed: '0 14 * * *'
 - trigger:
     name: 'compass-os-nosdn-kvm-ha-virtual-master-trigger'
     triggers:
index d78ddc5..5685444 100755 (executable)
@@ -10,6 +10,9 @@
 set -o errexit
 set -o pipefail
 
+# use proxy url to replace the nomral URL, for googleusercontent.com will be blocked randomly
+[[ "$NODE_NAME" =~ (zte) ]] && GS_URL=$GS_BASE_PROXY
+
 if [[ "$JOB_NAME" =~ "merge" ]]; then
     echo "Downloading http://$GS_URL/opnfv-gerrit-$GERRIT_CHANGE_NUMBER.properties"
     # get the properties file for the Fuel ISO built for a merged change
@@ -47,6 +50,8 @@ if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then
     fi
 fi
 
+[[ "$NODE_NAME" =~ (zte) ]] && OPNFV_ARTIFACT_URL=${GS_BASE_PROXY%%/*}/$OPNFV_ARTIFACT_URL
+
 # log info to console
 echo "Downloading the $INSTALLER_TYPE artifact using URL http://$OPNFV_ARTIFACT_URL"
 echo "This could take some time..."
index 2917e5b..e88197d 100644 (file)
                 - 'rally_full'
                 - 'vims'
                 - 'multisite'
+                - 'parser'
 - parameter:
     name: functest-parameter
     parameters:
index ae03eab..1c998c9 100644 (file)
 - trigger:
     name: 'joid-os-odl_l2-nofeature-ha-baremetal-master-trigger'
     triggers:
-        - timed: '0 10 * * *'
+        - timed: '0 7 * * *'
 - trigger:
     name: 'joid-os-odl_l2-nofeature-ha-virtual-master-trigger'
     triggers:
 - trigger:
     name: 'joid-os-onos-nofeature-ha-baremetal-master-trigger'
     triggers:
-        - timed: '0 18 * * *'
+        - timed: '0 12 * * *'
 - trigger:
     name: 'joid-os-onos-nofeature-ha-virtual-master-trigger'
     triggers:
 - trigger:
     name: 'joid-os-onos-sfc-ha-baremetal-master-trigger'
     triggers:
-        - timed: '0 22 * * *'
+        - timed: '0 17 * * *'
 - trigger:
     name: 'joid-os-onos-sfc-ha-virtual-master-trigger'
     triggers:
 - trigger:
     name: 'joid-os-nosdn-lxd-noha-baremetal-master-trigger'
     triggers:
-        - timed: ''
+        - timed: '0 22 * * *'
 - trigger:
     name: 'joid-os-nosdn-lxd-noha-virtual-master-trigger'
     triggers:
 - trigger:
     name: 'joid-os-nosdn-lxd-ha-baremetal-master-trigger'
     triggers:
-        - timed: ''
+        - timed: '0 10 * * *'
 - trigger:
     name: 'joid-os-nosdn-lxd-ha-virtual-master-trigger'
     triggers:
index 7a47f9a..868de13 100755 (executable)
@@ -1,3 +1,10 @@
 #!/bin/bash
-
+##########################################################
+##This script includes executing cyclictest scripts.
+##########################################################
+#The latest build packages are stored in build_output
 ls -al $WORKSPACE/build_output
+
+#start the test
+cd $WORKSPACE
+./ci/test_kvmfornfv.sh
index ab99eef..00b211c 100644 (file)
@@ -82,6 +82,9 @@
             name: KINGBIRD_LOG_FILE
             default: $WORKSPACE/kingbird.log
         - 'intel-virtual6-defaults'
+        - string:
+            name: DEPLOY_SCENARIO
+            default: 'os-nosdn-multisite-ha'
 
     scm:
         - gerrit-trigger-scm:
index c14ea6c..8328aec 100644 (file)
@@ -13,7 +13,7 @@
             description: "URL to Google Storage."
         - string:
             name: GS_BASE_PROXY
-            default: build.opnfv.org/artifacts/$PROJECT
+            default: build.opnfv.org/artifacts.opnfv.org/$PROJECT
             description: "URL to Google Storage proxy"
 
 - parameter:
index e8df9be..7e9a65b 100755 (executable)
@@ -23,6 +23,11 @@ elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then
     # replace the default one by the customized one provided by jenkins config
 fi
 
+# Set iptables rule to allow forwarding return traffic for container
+if ! sudo iptables -C FORWARD -j RETURN 2> ${redirect} || ! sudo iptables -L FORWARD | awk 'NR==3' | grep RETURN 2> ${redirect}; then
+    sudo iptables -I FORWARD -j RETURN
+fi
+
 opts="--privileged=true --rm"
 envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
     -e NODE_NAME=${NODE_NAME} -e EXTERNAL_NETWORK=${EXTERNAL_NETWORK} \
diff --git a/prototypes/bifrost/.gitkeep b/prototypes/bifrost/.gitkeep
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/prototypes/puppet-infracloud/.gitkeep b/prototypes/puppet-infracloud/.gitkeep
new file mode 100644 (file)
index 0000000..e69de29
index 622c375..7c943d8 100644 (file)
@@ -99,8 +99,9 @@ for version in conf.versions:
                 for test_case in testValid:
                     test_case.checkRunnable(installer, s,
                                             test_case.getConstraints())
-                    logger.debug("testcase %s is %s" %
+                    logger.debug("testcase %s (%s) is %s" %
                                  (test_case.getDisplayName(),
+                                  test_case.getName(),
                                   test_case.isRunnable))
                     time.sleep(1)
                     if test_case.isRunnable:
@@ -131,8 +132,10 @@ for version in conf.versions:
                 for test_case in otherTestCases:
                     test_case.checkRunnable(installer, s,
                                             test_case.getConstraints())
-                    logger.info("testcase %s is %s" %
-                                (test_case.getName(), test_case.isRunnable))
+                    logger.debug("testcase %s (%s) is %s" %
+                                 (test_case.getDisplayName(),
+                                  test_case.getName(),
+                                  test_case.isRunnable))
                     time.sleep(1)
                     if test_case.isRunnable:
                         dbName = test_case.getDbName()
index a58eeec..9c618a2 100644 (file)
 #
 # ****************************************************
 installers = ["apex", "compass", "fuel", "joid"]
-# installers = ["apex"]
 # list of test cases declared in testcases.yaml but that must not be
 # taken into account for the scoring
-blacklist = ["odl", "ovno", "security_scan", "copper", "moon"]
+blacklist = ["ovno", "security_scan"]
 # versions = ["brahmaputra", "master"]
 versions = ["master"]
-PERIOD = 10
-MAX_SCENARIO_CRITERIA = 18
+PERIOD = 50
+MAX_SCENARIO_CRITERIA = 50
 # get the last 5 test results to determinate the success criteria
 NB_TESTS = 5
 # REPORTING_PATH = "/usr/share/nginx/html/reporting/functest"
 REPORTING_PATH = "."
 URL_BASE = 'http://testresults.opnfv.org/test/api/v1/results'
 TEST_CONF = "https://git.opnfv.org/cgit/functest/plain/ci/testcases.yaml"
-LOG_LEVEL = "ERROR"
+LOG_LEVEL = "DEBUG"
 LOG_FILE = REPORTING_PATH + "/reporting.log"
index e19853a..e973035 100644 (file)
@@ -35,7 +35,11 @@ class TestCase(object):
                                'promise': 'Promise',
                                'moon': 'moon',
                                'copper': 'copper',
-                               'security_scan': 'security'
+                               'security_scan': 'security',
+                               'multisite': 'multisite',
+                               'domino': 'domino',
+                               'odl-sfc': 'SFC',
+                               'onos_sfc': 'SFC'
                                }
         try:
             self.displayName = display_name_matrix[self.name]
@@ -123,7 +127,11 @@ class TestCase(object):
                              'promise': 'promise',
                              'moon': 'moon',
                              'copper': 'copper',
-                             'security_scan': 'security'
+                             'security_scan': 'security',
+                             'multisite': 'multisite',
+                             'domino': 'domino-multinode',
+                             'odl-sfc': 'odl-sfc',
+                             'onos_sfc': 'onos_sfc'
                              }
         try:
             return test_match_matrix[self.name]
index d3aef7e..738f30a 100644 (file)
@@ -96,6 +96,7 @@ host=10.63.243.17
 user=zte
 port=8000
 image=opnfv/testapi
+mode=build
 update_path=/tmp/testapi
 mongodb_url=mongodb://172.17.0.1:27017
 swagger_url=http://10.63.243.17:8000"```
diff --git a/utils/test/result_collection_api/update/templates/rm_images.sh b/utils/test/result_collection_api/update/templates/rm_images.sh
new file mode 100755 (executable)
index 0000000..6722573
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+number=`docker images | awk 'NR != 1' | grep testapi | wc -l`
+if [ $number -gt 0 ]; then
+    images=`docker images -a | awk 'NR != 1' | grep testapi | awk '{print $1}'`
+    echo "begin to rm images $images"
+    docker images | awk 'NR != 1' | grep testapi | awk '{print $3}' | xargs docker rmi -f &>/dev/null
+fi
index 0883956..e6663d9 100644 (file)
@@ -8,6 +8,7 @@
     port: "8000"
     update_path: "/tmp/testapi"
     image: "opnfv/testapi"
+    mode: "pull"
     mongodb_url: "mongodb://172.17.0.1:27017"
     swagger_url: "http://{{ host }}:{{ port }}"
   tasks:
       copy:
         src: templates/
         dest: "{{ update_path }}"
+    - name: transfer Dockerfile
+      copy:
+        src: ../docker/Dockerfile
+        dest: "{{ update_path }}"
+      when: mode == "build"
     - name: backup mongodb database
       command: "python {{ update_path }}/backup_mongodb.py -u {{ mongodb_url }} -o {{ update_path }}"
     - name: stop and remove old versions
       register: rm_result
     - debug: msg="{{ rm_result.stderr }}"
     - name: delete old docker images
-      command: docker rmi "{{ image }}"
+      command: bash "{{ update_path }}/rm_images.sh"
       ignore_errors: true
     - name: update mongodb
       command: "python {{ update_path }}/update_mongodb.py -u {{ mongodb_url }}"
+    - name: docker build image
+      command: "docker build -t {{ image }} {{ update_path }}"
+      when: mode == "build"
     - name: docker start testapi server
       command: docker run -dti -p "{{ port }}:8000"
                -e "mongodb_url={{ mongodb_url }}"