diff options
36 files changed, 606 insertions, 115 deletions
diff --git a/jjb/apex/apex-build.sh b/jjb/apex/apex-build.sh index f6b2e3214..7b7295855 100755 --- a/jjb/apex/apex-build.sh +++ b/jjb/apex/apex-build.sh @@ -44,10 +44,10 @@ if ! echo $BUILD_TAG | grep "apex-verify" 1> /dev/null; then echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)" echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)" echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso" - echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/release/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)" + echo "OPNFV_ARTIFACT_SHA512SUM=$(sha512sum $BUILD_DIRECTORY/release/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)" echo "OPNFV_SRPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.src.rpm" echo "OPNFV_RPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.noarch.rpm" - echo "OPNFV_RPM_MD5SUM=$(md5sum $BUILD_DIRECTORY/noarch/opnfv-apex-$RPM_VERSION.noarch.rpm | cut -d' ' -f1)" + echo "OPNFV_RPM_SHA512SUM=$(sha512sum $BUILD_DIRECTORY/noarch/opnfv-apex-$RPM_VERSION.noarch.rpm | cut -d' ' -f1)" echo "OPNFV_BUILD_URL=$BUILD_URL" ) > $WORKSPACE/opnfv.properties fi diff --git a/jjb/apex/apex.yml b/jjb/apex/apex.yml index da9089cd6..1655dc488 100644 --- a/jjb/apex/apex.yml +++ b/jjb/apex/apex.yml @@ -983,36 +983,6 @@ 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: | BUILD_DIRECTORY=apex-build-{stream1}/build diff --git a/jjb/armband/armband-ci-jobs.yml b/jjb/armband/armband-ci-jobs.yml index 9d7c198d0..03c1fb074 100644 --- a/jjb/armband/armband-ci-jobs.yml +++ b/jjb/armband/armband-ci-jobs.yml @@ -39,17 +39,17 @@ 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}' @@ -190,11 +190,26 @@ #---------------------------------------------------------- # 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 #--------------------------------------------------------------- @@ -202,6 +217,22 @@ 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 #---------------------------------------------------------- @@ -210,6 +241,22 @@ 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 #--------------------------------------------------------------- @@ -217,3 +264,19 @@ 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: '' diff --git a/jjb/armband/build.sh b/jjb/armband/build.sh index 81917f6de..26c46d2fc 100755 --- a/jjb/armband/build.sh +++ b/jjb/armband/build.sh @@ -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 diff --git a/jjb/compass4nfv/compass-ci-jobs.yml b/jjb/compass4nfv/compass-ci-jobs.yml index bb24fdf51..eb30004d1 100644 --- a/jjb/compass4nfv/compass-ci-jobs.yml +++ b/jjb/compass4nfv/compass-ci-jobs.yml @@ -238,7 +238,7 @@ - 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: @@ -246,11 +246,11 @@ - 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: @@ -258,7 +258,7 @@ - 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: @@ -271,27 +271,27 @@ - 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: @@ -337,11 +337,11 @@ - 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: @@ -349,19 +349,19 @@ - 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: diff --git a/jjb/compass4nfv/compass-deploy.sh b/jjb/compass4nfv/compass-deploy.sh index d71316459..65e44b670 100644 --- a/jjb/compass4nfv/compass-deploy.sh +++ b/jjb/compass4nfv/compass-deploy.sh @@ -25,8 +25,18 @@ echo 1 > /proc/sys/vm/drop_caches export CONFDIR=$WORKSPACE/deploy/conf export ISO_URL=file://$BUILD_DIRECTORY/compass.iso +cd $WORKSPACE + +export OS_VERSION=${COMPASS_OS_VERSION} +export OPENSTACK_VERSION=${COMPASS_OPENSTACK_VERSION} +if [[ "${COMPASS_OS_VERSION_OPTION}" = "xenial" ]] && [[ "${OPENSTACK_VERSION}" = "mitaka" ]]; then + export OPENSTACK_VERSION=${OPENSTACK_VERSION}_${COMPASS_OS_VERSION_OPTION} + export OS_VERSION=${COMPASS_OS_VERSION_OPTION} +fi + if [[ "${DEPLOY_SCENARIO}" =~ "-ocl" ]]; then export NETWORK_CONF_FILE=network_ocl.yml + export OPENSTACK_VERSION=liberty elif [[ "${DEPLOY_SCENARIO}" =~ "-onos" ]]; then export NETWORK_CONF_FILE=network_onos.yml else @@ -42,14 +52,6 @@ else export DHA_CONF=$CONFDIR/hardware_environment/$NODE_NAME/${DEPLOY_SCENARIO}.yml fi -cd $WORKSPACE - -export OS_VERSION=${COMPASS_OS_VERSION} -export OPENSTACK_VERSION=${COMPASS_OPENSTACK_VERSION} -if [[ "${COMPASS_OS_VERSION_OPTION}" = "xenial" ]] && [[ "${OPENSTACK_VERSION}" = "mitaka" ]]; then - export OPENSTACK_VERSION=${OPENSTACK_VERSION}_${COMPASS_OS_VERSION_OPTION} - export OS_VERSION=${COMPASS_OS_VERSION_OPTION} -fi ./deploy.sh --dha ${DHA_CONF} --network ${NETWORK_CONF} if [ $? -ne 0 ]; then echo "depolyment failed!" diff --git a/jjb/fuel/fuel-build.sh b/jjb/fuel/fuel-build.sh index 662a1f46e..7e36a0c53 100755 --- a/jjb/fuel/fuel-build.sh +++ b/jjb/fuel/fuel-build.sh @@ -87,7 +87,7 @@ ls -al $BUILD_DIRECTORY echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)" echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)" echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso" - echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)" + echo "OPNFV_ARTIFACT_SHA512SUM=$(sha512sum $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)" echo "OPNFV_BUILD_URL=$BUILD_URL" ) > $WORKSPACE/opnfv.properties diff --git a/jjb/fuel/fuel-ci-jobs.yml b/jjb/fuel/fuel-ci-jobs.yml index aa5a72751..70942dd25 100644 --- a/jjb/fuel/fuel-ci-jobs.yml +++ b/jjb/fuel/fuel-ci-jobs.yml @@ -32,6 +32,12 @@ - zte-pod1: slave-label: zte-pod1 <<: *master + - zte-pod2: + slave-label: zte-pod2 + <<: *master + - zte-pod3: + slave-label: zte-pod3 + <<: *master #-------------------------------- # scenarios #-------------------------------- @@ -131,7 +137,7 @@ same-node: true block: true - trigger-builds: - - project: 'yardstick-fuel-{pod}-daily-{stream}' + - project: 'functest-fuel-{pod}-daily-{stream}' current-parameters: false predefined-parameters: DEPLOY_SCENARIO={scenario} @@ -142,7 +148,7 @@ failure-threshold: 'never' unstable-threshold: 'FAILURE' - trigger-builds: - - project: 'functest-fuel-{pod}-daily-{stream}' + - project: 'yardstick-fuel-{pod}-daily-{stream}' current-parameters: false predefined-parameters: DEPLOY_SCENARIO={scenario} @@ -196,6 +202,9 @@ wrappers: - build-name: name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO' + - timeout: + timeout: 150 + abort: true builders: - description-setter: @@ -272,7 +281,7 @@ - trigger: name: 'fuel-os-nosdn-ovs-ha-baremetal-daily-master-trigger' triggers: - - timed: '' + - timed: '0 20 * * *' # NOHA Scenarios - trigger: @@ -388,6 +397,7 @@ name: 'fuel-os-nosdn-ovs-noha-virtual-daily-master-trigger' triggers: - timed: '0 9 * * *' + #----------------------------------------------- # ZTE POD1 Triggers running against master branch #----------------------------------------------- @@ -464,3 +474,157 @@ name: 'fuel-os-nosdn-ovs-noha-zte-pod1-daily-master-trigger' triggers: - timed: '' + +#----------------------------------------------- +# ZTE POD2 Triggers running against master branch +#----------------------------------------------- +- trigger: + name: 'fuel-os-nosdn-nofeature-ha-zte-pod2-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-odl_l2-nofeature-ha-zte-pod2-daily-master-trigger' + triggers: + - timed: '0 18 * * *' +- trigger: + name: 'fuel-os-odl_l3-nofeature-ha-zte-pod2-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-onos-sfc-ha-zte-pod2-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-onos-nofeature-ha-zte-pod2-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-odl_l2-bgpvpn-ha-zte-pod2-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-odl_l2-sfc-ha-zte-pod2-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-nosdn-kvm-ha-zte-pod2-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-nosdn-ovs-ha-zte-pod2-daily-master-trigger' + triggers: + - timed: '' +# NOHA Scenarios +- trigger: + name: 'fuel-os-nosdn-nofeature-noha-zte-pod2-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-odl_l2-nofeature-noha-zte-pod2-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-odl_l3-nofeature-noha-zte-pod2-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-onos-sfc-noha-zte-pod2-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-onos-nofeature-noha-zte-pod2-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-odl_l2-sfc-noha-zte-pod2-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-odl_l2-bgpvpn-noha-zte-pod2-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-nosdn-kvm-noha-zte-pod2-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-nosdn-ovs-noha-zte-pod2-daily-master-trigger' + triggers: + - timed: '' +#----------------------------------------------- +# ZTE POD3 Triggers running against master branch +#----------------------------------------------- +- trigger: + name: 'fuel-os-nosdn-nofeature-ha-zte-pod3-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-odl_l2-nofeature-ha-zte-pod3-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-odl_l3-nofeature-ha-zte-pod3-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-onos-sfc-ha-zte-pod3-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-onos-nofeature-ha-zte-pod3-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-odl_l2-bgpvpn-ha-zte-pod3-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-odl_l2-sfc-ha-zte-pod3-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-nosdn-kvm-ha-zte-pod3-daily-master-trigger' + triggers: + - timed: '0 10 * * *' +- trigger: + name: 'fuel-os-nosdn-ovs-ha-zte-pod3-daily-master-trigger' + triggers: + - timed: '' +# NOHA Scenarios +- trigger: + name: 'fuel-os-nosdn-nofeature-noha-zte-pod3-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-odl_l2-nofeature-noha-zte-pod3-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-odl_l3-nofeature-noha-zte-pod3-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-onos-sfc-noha-zte-pod3-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-onos-nofeature-noha-zte-pod3-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-odl_l2-sfc-noha-zte-pod3-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-odl_l2-bgpvpn-noha-zte-pod3-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-nosdn-kvm-noha-zte-pod3-daily-master-trigger' + triggers: + - timed: '' +- trigger: + name: 'fuel-os-nosdn-ovs-noha-zte-pod3-daily-master-trigger' + triggers: + - timed: '' + diff --git a/jjb/fuel/fuel-deploy.sh b/jjb/fuel/fuel-deploy.sh index c30041711..730f0d116 100755 --- a/jjb/fuel/fuel-deploy.sh +++ b/jjb/fuel/fuel-deploy.sh @@ -29,7 +29,7 @@ fi # set deployment parameters export TMPDIR=$HOME/tmpdir -BRIDGE=pxebr +BRIDGE=${BRIDGE:-pxebr} LAB_NAME=${NODE_NAME/-*} POD_NAME=${NODE_NAME/*-} diff --git a/jjb/fuel/fuel-download-artifact.sh b/jjb/fuel/fuel-download-artifact.sh index d78ddc5ba..5685444f8 100755 --- a/jjb/fuel/fuel-download-artifact.sh +++ b/jjb/fuel/fuel-download-artifact.sh @@ -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..." diff --git a/jjb/functest/functest-ci-jobs.yml b/jjb/functest/functest-ci-jobs.yml index 2917e5b39..3109fcb6e 100644 --- a/jjb/functest/functest-ci-jobs.yml +++ b/jjb/functest/functest-ci-jobs.yml @@ -119,6 +119,14 @@ slave-label: '{pod}' installer: fuel <<: *master + - zte-pod2: + slave-label: '{pod}' + installer: fuel + <<: *master + - zte-pod3: + slave-label: '{pod}' + installer: fuel + <<: *master - arm-pod1: slave-label: '{pod}' installer: fuel @@ -222,6 +230,7 @@ - 'rally_full' - 'vims' - 'multisite' + - 'parser' - parameter: name: functest-parameter parameters: diff --git a/jjb/joid/joid-ci-jobs.yml b/jjb/joid/joid-ci-jobs.yml index ae03eab4a..1c998c9c4 100644 --- a/jjb/joid/joid-ci-jobs.yml +++ b/jjb/joid/joid-ci-jobs.yml @@ -253,7 +253,7 @@ - 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: @@ -289,7 +289,7 @@ - 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: @@ -307,7 +307,7 @@ - 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: @@ -359,7 +359,7 @@ - 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: @@ -395,7 +395,7 @@ - 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: diff --git a/jjb/kvmfornfv/kvmfornfv-download-artifact.sh b/jjb/kvmfornfv/kvmfornfv-download-artifact.sh index 89b7e3164..1f99f177b 100755 --- a/jjb/kvmfornfv/kvmfornfv-download-artifact.sh +++ b/jjb/kvmfornfv/kvmfornfv-download-artifact.sh @@ -1,4 +1,7 @@ #!/bin/bash +set -o errexit +set -o nounset +set -o pipefail if [[ "$JOB_NAME" =~ (verify|merge|daily|weekly) ]]; then JOB_TYPE=${BASH_REMATCH[0]} diff --git a/jjb/kvmfornfv/kvmfornfv-test.sh b/jjb/kvmfornfv/kvmfornfv-test.sh index 7a47f9a6e..868de13bd 100755 --- a/jjb/kvmfornfv/kvmfornfv-test.sh +++ b/jjb/kvmfornfv/kvmfornfv-test.sh @@ -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 diff --git a/jjb/kvmfornfv/kvmfornfv-upload-artifact.sh b/jjb/kvmfornfv/kvmfornfv-upload-artifact.sh index 190ab4b4d..327ea97e8 100755 --- a/jjb/kvmfornfv/kvmfornfv-upload-artifact.sh +++ b/jjb/kvmfornfv/kvmfornfv-upload-artifact.sh @@ -1,4 +1,6 @@ #!/bin/bash +set -o errexit +set -o nounset if [[ "$JOB_NAME" =~ (verify|merge|daily|weekly) ]]; then JOB_TYPE=${BASH_REMATCH[0]} @@ -9,11 +11,13 @@ fi case "$JOB_TYPE" in verify) - echo "Uploading artifacts for the change $GERRIT_CHANGE_NUMBER. This could take some time..." GS_UPLOAD_LOCATION="gs://artifacts.opnfv.org/$PROJECT/review/$GERRIT_CHANGE_NUMBER" + echo "Removing outdated artifacts produced for the previous patch for the change $GERRIT_CHANGE_NUMBER" + gsutil ls $GS_UPLOAD_LOCATION > /dev/null 2>&1 && gsutil rm -r $GS_UPLOAD_LOCATION + echo "Uploading artifacts for the change $GERRIT_CHANGE_NUMBER. This could take some time..." ;; daily) - echo "Uploding daily artifacts This could take some time..." + echo "Uploading daily artifacts This could take some time..." OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S") GS_UPLOAD_LOCATION="gs://$GS_URL/$OPNFV_ARTIFACT_VERSION" ;; @@ -22,7 +26,7 @@ case "$JOB_TYPE" in exit 1 esac -gsutil cp -r $WORKSPACE/build_output $GS_UPLOAD_LOCATION > $WORKSPACE/gsutil.log 2>&1 +gsutil cp -r $WORKSPACE/build_output/* $GS_UPLOAD_LOCATION > $WORKSPACE/gsutil.log 2>&1 gsutil -m setmeta -r \ -h "Cache-Control:private, max-age=0, no-transform" \ $GS_UPLOAD_LOCATION > /dev/null 2>&1 diff --git a/jjb/multisite/multisite.yml b/jjb/multisite/multisite.yml index ab99eefad..00b211ceb 100644 --- a/jjb/multisite/multisite.yml +++ b/jjb/multisite/multisite.yml @@ -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: diff --git a/jjb/onosfw/onosfw.yml b/jjb/onosfw/onosfw.yml index 0335b71b2..8c23b0832 100644 --- a/jjb/onosfw/onosfw.yml +++ b/jjb/onosfw/onosfw.yml @@ -143,7 +143,7 @@ echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)" echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)" echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso" - echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/onosfw.iso | cut -d' ' -f1)" + echo "OPNFV_ARTIFACT_SHA512SUM=$(sha512sum $BUILD_DIRECTORY/onosfw.iso | cut -d' ' -f1)" echo "OPNFV_BUILD_URL=$BUILD_URL" ) > $BUILD_DIRECTORY/opnfv.properties echo diff --git a/jjb/opnfv/installer-params.yml b/jjb/opnfv/installer-params.yml index 60fee9263..b7954086e 100644 --- a/jjb/opnfv/installer-params.yml +++ b/jjb/opnfv/installer-params.yml @@ -1,4 +1,24 @@ - parameter: + name: 'armband-defaults' + parameters: + - string: + name: INSTALLER_IP + default: '10.20.0.2' + description: 'IP of the installer' + - string: + name: INSTALLER_TYPE + default: fuel + description: 'Installer used for deploying OPNFV on this POD' + - string: + name: EXTERNAL_NETWORK + default: 'admin_floating_net' + description: 'external network for test' + - string: + name: BRIDGE + default: 'pxebr' + description: 'pxe bridge for booting of Fuel master' + +- parameter: name: 'apex-defaults' parameters: - string: @@ -49,6 +69,10 @@ name: EXTERNAL_NETWORK default: 'admin_floating_net' description: 'external network for test' + - string: + name: BRIDGE + default: 'pxebr' + description: 'pxe bridge for booting of Fuel master' - parameter: name: 'joid-defaults' diff --git a/jjb/opnfv/opnfv-lint.yml b/jjb/opnfv/opnfv-lint.yml index 9611a380c..cda882e32 100644 --- a/jjb/opnfv/opnfv-lint.yml +++ b/jjb/opnfv/opnfv-lint.yml @@ -51,7 +51,7 @@ comment-contains-value: 'reverify' projects: - project-compare-type: 'REG_EXP' - project-pattern: 'functest|sdnvpn|qtip' + project-pattern: 'functest|sdnvpn|qtip|daisy' branches: - branch-compare-type: 'ANT' branch-pattern: '**/{branch}' diff --git a/jjb/opnfv/slave-params.yml b/jjb/opnfv/slave-params.yml index b5cf4cd9d..641ae4e51 100644 --- a/jjb/opnfv/slave-params.yml +++ b/jjb/opnfv/slave-params.yml @@ -336,6 +336,14 @@ name: GIT_BASE default: https://gerrit.opnfv.org/gerrit/$PROJECT description: 'Git URL to use on this Jenkins Slave' + - string: + name: INSTALLER_IP + default: '10.20.6.2' + description: 'IP of the installer' + - string: + name: BRIDGE + default: 'br6' + description: 'pxe bridge for booting of Fuel master' - parameter: name: 'zte-pod2-defaults' parameters: @@ -352,8 +360,30 @@ description: 'Git URL to use on this Jenkins Slave' - string: name: INSTALLER_IP - default: '10.20.1.2' + default: '10.20.7.2' description: 'IP of the installer' + - string: + name: BRIDGE + default: 'br7' + description: 'pxe bridge for booting of Fuel master' +- parameter: + name: 'zte-pod3-defaults' + parameters: + - node: + name: SLAVE_NAME + description: 'Slave name on Jenkins' + allowed-slaves: + - zte-pod3 + default-slaves: + - zte-pod3 + - string: + name: GIT_BASE + default: https://gerrit.opnfv.org/gerrit/$PROJECT + description: 'Git URL to use on this Jenkins Slave' + - string: + name: BRIDGE + default: 'br0' + description: 'pxe bridge for booting of Fuel master' - parameter: name: 'juniper-pod1-defaults' parameters: diff --git a/jjb/qtip/qtip-ci-jobs.yml b/jjb/qtip/qtip-ci-jobs.yml index ef455f8df..1123d27fb 100644 --- a/jjb/qtip/qtip-ci-jobs.yml +++ b/jjb/qtip/qtip-ci-jobs.yml @@ -40,11 +40,11 @@ auto-trigger-name: 'daily-trigger-disabled' - zte-pod1: installer: fuel - auto-trigger-name: 'qtip-daily-zte-pod1-trigger' + auto-trigger-name: 'daily-trigger-disabled' <<: *master - zte-pod2: installer: fuel - auto-trigger-name: 'daily-trigger-disabled' + auto-trigger-name: 'qtip-daily-zte-pod2-trigger' <<: *master #-------------------------------- @@ -188,6 +188,7 @@ # - timed : ' 0 0 * * *' - trigger: - name: 'qtip-daily-zte-pod1-trigger' + name: 'qtip-daily-zte-pod2-trigger' triggers: - timed: '0 5 * * *' + diff --git a/jjb/releng-macros.yaml b/jjb/releng-macros.yaml index c14ea6c47..8328aec03 100644 --- a/jjb/releng-macros.yaml +++ b/jjb/releng-macros.yaml @@ -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: diff --git a/jjb/yardstick/yardstick-ci-jobs.yml b/jjb/yardstick/yardstick-ci-jobs.yml index 6b922889a..c8d50a0ea 100644 --- a/jjb/yardstick/yardstick-ci-jobs.yml +++ b/jjb/yardstick/yardstick-ci-jobs.yml @@ -121,6 +121,21 @@ installer: fuel auto-trigger-name: 'daily-trigger-disabled' <<: *master + - zte-pod2: + slave-label: '{pod}' + installer: fuel + auto-trigger-name: 'daily-trigger-disabled' + <<: *master + - zte-pod3: + slave-label: '{pod}' + installer: fuel + auto-trigger-name: 'daily-trigger-disabled' + <<: *master + - arm-pod1: + slave-label: '{pod}' + installer: fuel + auto-trigger-name: 'daily-trigger-disabled' + <<: *master - orange-pod2: slave-label: '{pod}' installer: joid @@ -318,6 +333,22 @@ description: 'Arguments to use in order to choose the backend DB' - parameter: + name: 'yardstick-params-zte-pod2' + parameters: + - string: + name: YARDSTICK_DB_BACKEND + default: '-i 104.197.68.199:8086' + description: 'Arguments to use in order to choose the backend DB' + +- parameter: + name: 'yardstick-params-zte-pod3' + parameters: + - string: + name: YARDSTICK_DB_BACKEND + default: '-i 104.197.68.199:8086' + description: 'Arguments to use in order to choose the backend DB' + +- parameter: name: 'yardstick-params-orange-pod2' parameters: - string: @@ -326,6 +357,14 @@ description: 'Arguments to use in order to choose the backend DB' - parameter: + name: 'yardstick-params-arm-pod1' + parameters: + - string: + name: YARDSTICK_DB_BACKEND + default: '-i 104.197.68.199:8086' + description: 'Arguments to use in order to choose the backend DB' + +- parameter: name: 'yardstick-params-virtual' parameters: - string: diff --git a/jjb/yardstick/yardstick-daily.sh b/jjb/yardstick/yardstick-daily.sh index e8df9be58..7e9a65b82 100755 --- a/jjb/yardstick/yardstick-daily.sh +++ b/jjb/yardstick/yardstick-daily.sh @@ -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 index 000000000..e69de29bb --- /dev/null +++ b/prototypes/bifrost/.gitkeep diff --git a/prototypes/puppet-infracloud/.gitkeep b/prototypes/puppet-infracloud/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/prototypes/puppet-infracloud/.gitkeep diff --git a/utils/fetch_os_creds.sh b/utils/fetch_os_creds.sh index e11df599b..47fbc91dc 100755 --- a/utils/fetch_os_creds.sh +++ b/utils/fetch_os_creds.sh @@ -142,7 +142,6 @@ elif [ "$installer_type" == "compass" ]; then sshpass -p root ssh 2>/dev/null $ssh_options root@${installer_ip} \ "scp $ssh_options ${controller_ip}:/opt/admin-openrc.sh ." &> /dev/null sshpass -p root scp 2>/dev/null $ssh_options root@${installer_ip}:~/admin-openrc.sh $dest_path &> /dev/null - echo 'export OS_REGION_NAME=regionOne' >> $dest_path info "This file contains the mgmt keystone API, we need the public one for our rc file" public_ip=$(sshpass -p root ssh $ssh_options root@${installer_ip} \ diff --git a/utils/jenkins-jnlp-connect.sh b/utils/jenkins-jnlp-connect.sh index d268a28de..8dcaf35c5 100755 --- a/utils/jenkins-jnlp-connect.sh +++ b/utils/jenkins-jnlp-connect.sh @@ -49,8 +49,8 @@ main () { fi if [[ $(whoami) != "root" ]]; then - if grep "^Defaults requiretty" /etc/sudoers - then echo "please comment out Defaults requiretty from /etc/sudoers" + if sudo -l | grep "requiretty"; then + echo "please comment out Defaults requiretty from /etc/sudoers" exit 1 fi fi diff --git a/utils/test/reporting/functest/reporting-status.py b/utils/test/reporting/functest/reporting-status.py index 622c375cc..7c943d8b3 100644 --- a/utils/test/reporting/functest/reporting-status.py +++ b/utils/test/reporting/functest/reporting-status.py @@ -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() diff --git a/utils/test/reporting/functest/reportingConf.py b/utils/test/reporting/functest/reportingConf.py index a58eeecc9..1c0b0577d 100644 --- a/utils/test/reporting/functest/reportingConf.py +++ b/utils/test/reporting/functest/reportingConf.py @@ -10,14 +10,13 @@ # # **************************************************** 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", "odl", "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" diff --git a/utils/test/reporting/functest/testCase.py b/utils/test/reporting/functest/testCase.py index e19853a09..a906f0da8 100644 --- a/utils/test/reporting/functest/testCase.py +++ b/utils/test/reporting/functest/testCase.py @@ -35,7 +35,12 @@ 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', + 'parser':'parser' } try: self.displayName = display_name_matrix[self.name] @@ -122,8 +127,13 @@ class TestCase(object): 'doctor': 'doctor-notification', 'promise': 'promise', 'moon': 'moon', - 'copper': 'copper', - 'security_scan': 'security' + 'copper': 'copper-notification', + 'security_scan': 'security', + 'multisite': 'multisite', + 'domino': 'domino-multinode', + 'odl-sfc': 'odl-sfc', + 'onos_sfc': 'onos_sfc', + 'parser':'parser-basics' } try: return test_match_matrix[self.name] diff --git a/utils/test/result_collection_api/update/README.md b/utils/test/result_collection_api/update/README.md index d3aef7efe..cb0e67b33 100644 --- a/utils/test/result_collection_api/update/README.md +++ b/utils/test/result_collection_api/update/README.md @@ -79,26 +79,21 @@ install ansible, please refer: ``` http://docs.ansible.com/ansible/intro_installation.html ``` -run update.yml + +playbook-update.sh + arguments: -: host: remote server, must provide -user: user used to access to remote server, default to root -port: exposed port used to access to testapi, default to 8000 -image: testapi's docker image, default to opnfv/testapi:latest -update_path: templates directory in remote server, default to /tmp/testapi -mongodb_url: url of mongodb, default to 172.17.0.1, docker0 ip -swagger_url: swagger access url, default to http://host:port +: -h|--help show this help text +-r|--remote remote server +-u|--user ssh username used to access to remote server +-i|--identity ssh PublicKey file used to access to remote server +-e|--execute execute update, if not set just check the ansible connectivity usage: ``` -ansible-playbook update.yml --extra-vars " -host=10.63.243.17 -user=zte -port=8000 -image=opnfv/testapi -update_path=/tmp/testapi -mongodb_url=mongodb://172.17.0.1:27017 -swagger_url=http://10.63.243.17:8000"``` +ssh-agent ./playbook-update.sh -r testresults.opnfv.org -u serena -i ~/.ssh/id_rsa -e +``` + > **Note:** > - If documents need to be changed, please modify file diff --git a/utils/test/result_collection_api/update/playbook-update.sh b/utils/test/result_collection_api/update/playbook-update.sh new file mode 100755 index 000000000..86d30e4b2 --- /dev/null +++ b/utils/test/result_collection_api/update/playbook-update.sh @@ -0,0 +1,90 @@ +#!/bin/bash + +# +# Author: Serena Feng (feng.xiaoewi@zte.com.cn) +# Update testapi on remote server using ansible playbook automatically +# +# +# 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 -e + +usage="Script to trigger update automatically. + +usage: + bash $(basename "$0") [-h|--help] [-h <host>] [-u username] [-i identityfile] [-e|--execute] + +where: + -h|--help show this help text + -r|--remote remote server + -u|--user ssh username used to access to remote server + -i|--identity ssh PublicKey file used to access to remote server + -e|--execute execute update, if not set just check the ansible connectivity" + +remote=testresults.opnfv.org +user=root +identity=~/.ssh/id_rsa +hosts=./hosts +execute=false + +# Parse parameters +while [[ $# > 0 ]] + do + key="$1" + case $key in + -h|--help) + echo "$usage" + exit 0 + shift + ;; + -r|--remote) + remote="$2" + shift + ;; + -u|--user) + user="$2" + shift + ;; + -i|--identity) + identity="$2" + shift + ;; + -e|--execute) + execute=true + ;; + *) + echo "unknown option" + exit 1 + ;; + esac + shift # past argument or value +done + +echo $remote > $hosts + +echo "add authentication" +ssh-add $identity + +echo "test ansible connectivity" +ansible -i ./hosts $remote -m ping -u $user + +echo "test playbook connectivity" +ansible-playbook -i $hosts test.yml -e "host=$remote user=$user" + +if [ $execute == true ]; then + echo "do update" + ansible-playbook -i $hosts update.yml -e "host=$remote \ + user=$user \ + port=8082 \ + image=opnfv/testapi \ + update_path=/home/$user/testapi \ + mongodb_url=mongodb://172.17.0.1:27017 \ + swagger_url=http://testresults.opnfv.org/test" +fi + +rm -fr $hosts +ssh-agent -k 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 index 000000000..6722573b4 --- /dev/null +++ b/utils/test/result_collection_api/update/templates/rm_images.sh @@ -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 diff --git a/utils/test/result_collection_api/update/test.yml b/utils/test/result_collection_api/update/test.yml new file mode 100644 index 000000000..a8868720d --- /dev/null +++ b/utils/test/result_collection_api/update/test.yml @@ -0,0 +1,12 @@ +--- +- hosts: "{{ host }}" + remote_user: "{{ user }}" + become: yes + become_method: sudo + vars: + user: "root" + tasks: + - name: test connectivity + command: "echo hello {{ host }}" + register: result + - debug: msg="{{ result }}" diff --git a/utils/test/result_collection_api/update/update.yml b/utils/test/result_collection_api/update/update.yml index 08839564a..e6663d905 100644 --- a/utils/test/result_collection_api/update/update.yml +++ b/utils/test/result_collection_api/update/update.yml @@ -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: @@ -19,6 +20,11 @@ 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 @@ -26,10 +32,13 @@ 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 }}" |