diff options
41 files changed, 992 insertions, 259 deletions
diff --git a/jjb/apex/apex.yml b/jjb/apex/apex.yml index b48e81e8c..35a6bf730 100644 --- a/jjb/apex/apex.yml +++ b/jjb/apex/apex.yml @@ -216,15 +216,22 @@ - trigger-builds: - project: 'apex-deploy-virtual-os-nosdn-nofeature-ha-{stream1}' predefined-parameters: | - BUILD_DIRECTORY=apex-verify-{stream1}/build_output + BUILD_DIRECTORY=apex-verify-{stream1} OPNFV_CLEAN=yes git-revision: false block: true +# - trigger-builds: +# - project: 'functest-apex-{slave}-suite-{stream1}' +# predefined-parameters: | +# DEPLOY_SCENARIO=os-nosdn-nofeature-ha +# FUNCTEST_SUITE_NAME=vping_userdata +# block: true - trigger-builds: - - project: 'functest-apex-{slave}-suite-{stream1}' + - project: 'apex-deploy-virtual-os-odl_l2-nofeature-ha-{stream1}' predefined-parameters: | - DEPLOY_SCENARIO=os-nosdn-nofeature-ha - FUNCTEST_SUITE_NAME=vping_userdata + BUILD_DIRECTORY=apex-verify-{stream1} + OPNFV_CLEAN=yes + git-revision: false block: true - 'apex-workspace-cleanup' @@ -329,7 +336,7 @@ - trigger-builds: - project: 'apex-deploy-virtual-os-nosdn-nofeature-ha-{stream}' predefined-parameters: | - BUILD_DIRECTORY=apex-build-{stream}/build_output + BUILD_DIRECTORY=apex-build-{stream}/build OPNFV_CLEAN=yes git-revision: false block: true @@ -429,7 +436,7 @@ # branch: branch (eg. stable) node: '{slave}' - disabled: false + disabled: true scm: - git-scm: @@ -605,7 +612,7 @@ - trigger-builds: - project: 'apex-deploy-virtual-nosdn-nofeature-ha-{stream1}' predefined-parameters: | - BUILD_DIRECTORY=apex-build-{stream1}/build_output + BUILD_DIRECTORY=apex-build-{stream1}/build OPNFV_CLEAN=yes git-revision: true block: true @@ -628,6 +635,30 @@ failure-threshold: 'never' unstable-threshold: 'FAILURE' +- job-template: + name: 'apex-gs-clean-{stream}' + + # Job template for clean + # + # Required Variables: + # stream: branch with - in place of / (eg. stable) + node: '{slave}' + + disabled: false + + parameters: + - project-parameter: + project: '{project}' + - apex-parameter: + gs-pathname: '{gs-pathname}' + + builders: + - 'apex-gs-clean' + + triggers: + - 'apex-gs-clean-{stream}' + + ######################## # parameter macros ######################## @@ -644,7 +675,7 @@ description: "Artifact version type" - string: name: BUILD_DIRECTORY - default: $WORKSPACE/build_output + default: $WORKSPACE/build description: "Directory where the build artifact will be located upon the completion of the build." - string: name: CACHE_DIRECTORY @@ -708,7 +739,7 @@ # start the build cd $WORKSPACE/ci ./build.sh $BUILD_ARGS - RPM_VERSION=$(grep Version $BUILD_DIRECTORY/../build/opnfv-apex.spec | awk '{ print $2 }')-$(echo $OPNFV_ARTIFACT_VERSION | tr -d '_-') + RPM_VERSION=$(grep Version: $BUILD_DIRECTORY/opnfv-apex.spec | awk '{ print $2 }')-$(echo $OPNFV_ARTIFACT_VERSION | tr -d '_-') # list the contents of BUILD_OUTPUT directory ls -al $BUILD_DIRECTORY # save information regarding artifact into file @@ -717,10 +748,10 @@ 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-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)" + echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $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/opnfv-apex-$RPM_VERSION.noarch.rpm | cut -d' ' -f1)" + echo "OPNFV_RPM_MD5SUM=$(md5sum $BUILD_DIRECTORY/noarch/opnfv-apex-$RPM_VERSION.noarch.rpm | cut -d' ' -f1)" echo "OPNFV_BUILD_URL=$BUILD_URL" ) > $WORKSPACE/opnfv.properties echo "--------------------------------------------------------" @@ -736,7 +767,7 @@ set -o pipefail # delete everything that is in $WORKSPACE - /bin/rm -rf $WORKSPACE + sudo /bin/rm -rf $WORKSPACE - builder: name: 'apex-upload-artifact' @@ -756,16 +787,17 @@ source $WORKSPACE/opnfv.properties # upload artifact and additional files to google storage - gsutil cp $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1 - RPM_INSTALL_PATH=$BUILD_DIRECTORY/$(basename $OPNFV_RPM_URL) - RPM_LIST=$RPM_INSTALL_PATH - for pkg in common undercloud opendaylight-sfc; do - RPM_LIST+=" ${RPM_INSTALL_PATH/opnfv-apex/opnfv-apex-${pkg}}" + gsutil cp $BUILD_DIRECTORY/release/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1 + RPM_INSTALL_PATH=$BUILD_DIRECTORY/noarch + RPM_LIST=$RPM_INSTALL_PATH/$(basename $OPNFV_RPM_URL) + VERSION_EXTENSION=$(echo $(basename $OPNFV_RPM_URL) | sed 's/opnfv-apex-//') + for pkg in common undercloud opendaylight-sfc onos; do + RPM_LIST+=" ${RPM_INSTALL_PATH}/opnfv-apex-${pkg}-${VERSION_EXTENSION}" done - SRPM_INSTALL_PATH=$BUILD_DIRECTORY/$(basename $OPNFV_SRPM_URL) - SRPM_LIST=$SRPM_INSTALL_PATH - for pkg in common undercloud opendaylight-sfc; do - SRPM_LIST+=" ${SRPM_INSTALL_PATH/opnfv-apex/opnfv-apex-${pkg}}" + SRPM_INSTALL_PATH=$BUILD_DIRECTORY + SRPM_LIST=$SRPM_INSTALL_PATH/$(basename $OPNFV_SRPM_URL) + for pkg in common undercloud opendaylight-sfc onos; do + SRPM_LIST+=" ${SRPM_INSTALL_PATH}/opnfv-apex-${pkg}-${VERSION_EXTENSION}" done for artifact in $RPM_LIST $SRPM_LIST; do gsutil cp $artifact gs://$GS_URL/$(basename $artifact) > gsutil.iso.log 2>&1 @@ -780,6 +812,30 @@ echo "RPM Artifact is available as http://$GS_URL/$(basename $OPNFV_RPM_URL)" - builder: + name: 'apex-gs-cleanup' + builders: + - shell: | + #!/bin/bash + set -o errexit + set -o nounset + set -o pipefail + + # log info to console + echo "Cleaning Google Storage" + echo "-----------------------" + echo + + thirty_days_ago=$(date -d "30 days ago" +"%Y%m%d") + + for i in $(gsutil ls gs://$GS_URL/*201?*); do + filedate=$(date -d "$(echo $i | grep -Eo 201[0-9]-?[0-9][0-9]-?[0-9][0-9])" +"%Y%m%d") + if [ $filedate -lt $thirty_days_ago ]; then + # gsutil indicates what it is removing so no need for output here + gsutil rm $i + fi + done + +- builder: name: 'apex-deploy-virtual' builders: - shell: | @@ -801,7 +857,8 @@ elif [[ ! "$ARTIFACT_NAME" == "latest" ]]; then # if artifact name is passed the pull a # specific artifact from artifacts.opnfv.org - RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME + RPM_INSTALL_PATH=$GS_URL + RPM_LIST=$RPM_INSTALL_PATH/$ARTIFACT_NAME else if [[ $BUILD_DIRECTORY == *verify* ]]; then BUILD_DIRECTORY=$WORKSPACE/../$BUILD_DIRECTORY @@ -815,7 +872,8 @@ # if opnfv.properties exists then use the # local build. Source the file so we get local OPNFV vars source ${BUILD_DIRECTORY}/../opnfv.properties - RPM_INSTALL_PATH=${BUILD_DIRECTORY}/$(basename $OPNFV_RPM_URL) + RPM_INSTALL_PATH=${BUILD_DIRECTORY}/noarch + RPM_LIST=$RPM_INSTALL_PATH/$(basename $OPNFV_RPM_URL) else if [[ $BUILD_DIRECTORY == *verify* ]]; then echo "BUILD_DIRECTORY is from a verify job, so will not use latest from URL" @@ -832,7 +890,8 @@ [[ -f opnfv.properties ]] || exit 1 # source the file so we get OPNFV vars source opnfv.properties - RPM_INSTALL_PATH=$OPNFV_RPM_URL + RPM_INSTALL_PATH=$(echo $OPNFV_RPM_URL | sed 's/'"$(basename $OPNFV_RPM_URL)"'//') + RPM_LIST=$RPM_INSTALL_PATH/$(basename $OPNFV_RPM_URL) fi fi @@ -844,36 +903,75 @@ # use local build for verify if [[ $BUILD_DIRECTORY == *verify-master* ]]; then if [ ! -e "${WORKSPACE}/build/lib" ]; then ln -s ${WORKSPACE}/lib ${WORKSPACE}/build/lib; fi - DEPLOY_CMD="./deploy.sh -c ${WORKSPACE}/build -r ${WORKSPACE}/build/images/" + DEPLOY_CMD="CONFIG=${WORKSPACE}/build RESOURCES=${WORKSPACE}/build/images/ ./deploy.sh -c ${WORKSPACE}/build -r ${WORKSPACE}/build/images/" DEPLOY_FILE="${WORKSPACE}/config/deploy/${DEPLOY_SCENARIO}.yaml" NETWORK_FILE="${WORKSPACE}/config/network/network_settings.yaml" + # Make sure python34 is installed + if ! rpm -q python34 > /dev/null; then + sudo yum install -y epel-release + if ! sudo yum install -y python34; then + echo "Failed to install python34" + exit 1 + fi + fi + if ! rpm -q python34-PyYAML > /dev/null; then + sudo yum install -y epel-release + if ! sudo yum install -y python34-PyYAML; then + echo "Failed to install python34-PyYAML" + exit 1 + fi + fi + if ! rpm -q python34-setuptools > /dev/null; then + if ! sudo yum install -y python34-setuptools; then + echo "Failed to install python34-setuptools" + exit 1 + fi + fi + if [ -z ${PYTHONPATH:-} ]; then + export PYTHONPATH=${WORKSPACE}/lib/python + else + export PYTHONPATH=$PYTHONPATH:${WORKSPACE}/lib/python + fi else - RPM_LIST=$RPM_INSTALL_PATH - for pkg in common undercloud opendaylight-sfc; do - RPM_LIST+=" ${RPM_INSTALL_PATH/opnfv-apex/opnfv-apex-${pkg}}" + VERSION_EXTENSION=$(echo $(basename $RPM_LIST) | sed 's/opnfv-apex-//') + for pkg in common undercloud opendaylight-sfc onos; do + RPM_LIST+=" ${RPM_INSTALL_PATH}/opnfv-apex-${pkg}-${VERSION_EXTENSION}" done # update / install the new rpm if rpm -q opnfv-apex > /dev/null; then - if [ $(basename $OPNFV_RPM_URL) == $(rpm -q opnfv-apex).rpm ]; then - echo "RPM is already installed" - elif sudo yum update -y $RPM_LIST | grep "does not update installed package"; then - if ! sudo yum downgrade -y $RPM_LIST; then - sudo yum remove -y opnfv-undercloud opnfv-common - sudo yum downgrade -y $RPM_INSTALL_PATH + INSTALLED_RPMS=$(rpm -qa | grep apex) + for x in $INSTALLED_RPMS; do + INSTALLED_RPM_VER=$(echo $x | sed 's/opnfv-apex-//').rpm + # Does each RPM's version match the version required for deployment + if [ "$INSTALLED_RPM_VER" == "$VERSION_EXTENSION" ]; then + echo "RPM $x is already installed" + else + echo "RPM $x does not match $VERSION_EXTENSION" + echo "Will upgrade/downgrade RPMs..." + # Try to upgrade/downgrade RPMS + if sudo yum update -y $RPM_LIST | grep "does not update installed package"; then + if ! sudo yum downgrade -y $RPM_LIST; then + sudo yum remove -y opnfv-apex-undercloud opnfv-apex-common opnfv-apex-opendaylight-sfc opnfv-apex-onos + sudo yum downgrade -y $RPM_INSTALL_PATH + fi fi - fi + break + fi + done else sudo yum install -y $RPM_LIST; fi DEPLOY_CMD=opnfv-deploy DEPLOY_FILE="/etc/opnfv-apex/${DEPLOY_SCENARIO}.yaml" NETWORK_FILE="/etc/opnfv-apex/network_settings.yaml" + export RESOURCES="/var/opt/opnfv/images" + export CONFIG="/var/opt/opnfv" fi if [ "$OPNFV_CLEAN" == 'yes' ]; then if [[ $BUILD_DIRECTORY == *verify-master* ]]; then - sudo ./clean.sh + sudo CONFIG=../lib ./clean.sh else sudo opnfv-clean fi @@ -990,3 +1088,7 @@ name: 'apex-brahmaputra' triggers: - timed: '0 3 * * *' +- trigger: + name: 'apex-gs-clean-{stream}' + triggers: + - timed: '0 2 * * *' diff --git a/jjb/armband/armband-ci-jobs.yml b/jjb/armband/armband-ci-jobs.yml new file mode 100644 index 000000000..f9cb1e917 --- /dev/null +++ b/jjb/armband/armband-ci-jobs.yml @@ -0,0 +1,193 @@ +# jenkins job templates for Armband +- project: + name: 'armband-ci' + project: 'armband' + installer: 'fuel' + +#-------------------------------- +# BRANCH ANCHORS +#-------------------------------- + master: &master + stream: master + branch: '{stream}' + gs-pathname: '' + brahmaputra: &brahmaputra + stream: brahmaputra + branch: 'stable/{stream}' + gs-pathname: '/{stream}' +#-------------------------------- +# POD, INSTALLER, AND BRANCH MAPPING +#-------------------------------- +# brahmaputra +#-------------------------------- + pod: + - arm-pod1: + <<: *brahmaputra +#-------------------------------- +# master +#-------------------------------- +# No master deploys for now +# - arm-pod1: +# <<: *master +#-------------------------------- +# scenarios +#-------------------------------- + scenario: + # HA scenarios + - 'os-odl_l2-nofeature-ha': + auto-trigger-name: 'brahmaputra-trigger-daily-disabled' + + # NOHA scenarios + - 'os-odl_l2-nofeature-noha': + auto-trigger-name: 'brahmaputra-trigger-daily-disabled' + + jobs: + - 'armband-{scenario}-{pod}-daily-{stream}' + - 'armband-deploy-{pod}-daily-{stream}' + +######################## +# job templates +######################## +- job-template: + name: 'armband-{scenario}-{pod}-daily-{stream}' + + concurrent: false + + properties: + - throttle: + enabled: true + max-total: 1 + max-per-node: 1 + - build-blocker: + use-build-blocker: true + blocking-jobs: + - 'armband-os-.*?-{pod}-daily-{stream}' + block-level: 'NODE' + + wrappers: + - build-name: + name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO' + + triggers: + - '{auto-trigger-name}' + + parameters: + - project-parameter: + project: '{project}' + - '{installer}-defaults' + - '{pod}-defaults': + installer: '{installer}' + - string: + name: DEPLOY_SCENARIO + default: '{scenario}' + - armband-ci-parameter: + gs-pathname: '{gs-pathname}' + + builders: + - trigger-builds: + - project: 'armband-deploy-{pod}-daily-{stream}' + current-parameters: false + predefined-parameters: + DEPLOY_SCENARIO={scenario} + same-node: true + block: true + - trigger-builds: + - project: 'functest-{installer}-{pod}-daily-{stream}' + current-parameters: false + predefined-parameters: + DEPLOY_SCENARIO={scenario} + block: true + same-node: true + block-thresholds: + build-step-failure-threshold: 'never' + failure-threshold: 'never' + unstable-threshold: 'FAILURE' + +- job-template: + name: 'armband-deploy-{pod}-daily-{stream}' + + concurrent: false + + properties: + - throttle: + enabled: true + max-total: 1 + max-per-node: 1 + - build-blocker: + use-build-blocker: true + blocking-jobs: + - 'armband-deploy-{pod}-daily-{stream}' + - 'armband-deploy-generic-daily-.*' + block-level: 'NODE' + + parameters: + - project-parameter: + project: '{project}' + - '{installer}-defaults' + - '{pod}-defaults': + installer: '{installer}' + - string: + name: DEPLOY_SCENARIO + default: 'os-odl_l2-nofeature-ha' + - armband-ci-parameter: + gs-pathname: '{gs-pathname}' + + scm: + - git-scm: + credentials-id: '{ssh-credentials}' + refspec: '' + branch: '{branch}' + + wrappers: + - build-name: + name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO' + + builders: + - shell: + !include-raw-escape: ./armband-download-artifact.sh + - shell: + !include-raw-escape: ./armband-deploy.sh + + publishers: + - email: + recipients: josep.puigdemont@enea.com armband@enea.com + +######################## +# parameter macros +######################## +- parameter: + name: armband-ci-parameter + parameters: + - string: + name: BUILD_DIRECTORY + default: $WORKSPACE/build_output + description: "Directory where the build artifact will be located upon the completion of the build." + - string: + name: CACHE_DIRECTORY + default: $HOME/opnfv/cache/$INSTALLER_TYPE + description: "Directory where the cache to be used during the build is located." + - string: + name: GS_URL + default: artifacts.opnfv.org/$PROJECT{gs-pathname} + description: "URL to Google Storage." + +######################## +# trigger macros +######################## +# CI PODs +#---------------------------------------------------------- +# 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: '' + +#--------------------------------------------------------------- +# Enea Armband POD 1 Triggers running against brahmaputra branch +#--------------------------------------------------------------- +- trigger: + name: 'armband-os-odl_l2-nofeature-ha-arm-pod1-brahmaputra-trigger' + triggers: + - timed: '0 6 * * *' diff --git a/jjb/armband/armband-deploy.sh b/jjb/armband/armband-deploy.sh new file mode 100755 index 000000000..222a388e6 --- /dev/null +++ b/jjb/armband/armband-deploy.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2016 Ericsson AB and others. +# (c) 2016 Enea Software 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 +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +set -o errexit +set -o nounset +set -o pipefail + +# source the file so we get OPNFV vars +source latest.properties + +# echo the info about artifact that is used during the deployment +echo "Using ${OPNFV_ARTIFACT_URL/*\/} for deployment" + +if [[ "$JOB_NAME" =~ "merge" ]]; then + # set simplest scenario for virtual deploys to run for merges + DEPLOY_SCENARIO="os-nosdn-nofeature-ha" +else + # for none-merge deployments + # checkout the commit that was used for building the downloaded artifact + # to make sure the ISO and deployment mechanism uses same versions + echo "Checking out $OPNFV_GIT_SHA1" + git checkout $OPNFV_GIT_SHA1 --quiet +fi + +# set deployment parameters +export TMPDIR=$HOME/tmpdir +BRIDGE=${DEFAULT_BRIDGE:-pxebr} +LAB_NAME=${NODE_NAME/-*} +POD_NAME=${NODE_NAME/*-} + +# we currently support enea +if [[ ! "$LAB_NAME" =~ "enea" ]]; then + echo "Unsupported/unidentified lab $LAB_NAME. Cannot continue!" + exit 1 +else + echo "Using configuration for $LAB_NAME" +fi + +# create TMPDIR if it doesn't exist +mkdir -p $TMPDIR + +cd $WORKSPACE +if [[ $LAB_CONFIG_URL =~ ^git:// ]]; then + git clone --quiet --branch ${GIT_BRANCH##origin/} $LAB_CONFIG_URL lab-config + LAB_CONFIG_URL=file://${WORKSPACE}/lab-config +fi + +# construct the command +DEPLOY_COMMAND="$WORKSPACE/ci/deploy.sh -b ${LAB_CONFIG_URL} -l $LAB_NAME -p $POD_NAME -s $DEPLOY_SCENARIO -i file://$WORKSPACE/opnfv.iso -H -B $BRIDGE -S $TMPDIR" + +# log info to console +echo "Deployment parameters" +echo "--------------------------------------------------------" +echo "Scenario: $DEPLOY_SCENARIO" +echo "Lab: $LAB_NAME" +echo "POD: $POD_NAME" +echo "ISO: ${OPNFV_ARTIFACT_URL/*\/}" +echo +echo "Starting the deployment using $INSTALLER_TYPE. This could take some time..." +echo "--------------------------------------------------------" +echo + +# start the deployment +echo "Issuing command" +echo "$DEPLOY_COMMAND" +echo + +$DEPLOY_COMMAND + +echo +echo "--------------------------------------------------------" +echo "Deployment is done successfully!" diff --git a/jjb/armband/armband-download-artifact.sh b/jjb/armband/armband-download-artifact.sh new file mode 100755 index 000000000..15ad67d6e --- /dev/null +++ b/jjb/armband/armband-download-artifact.sh @@ -0,0 +1,66 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2016 Ericsson AB 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 pipefail + +if [[ "$JOB_NAME" =~ "merge" ]]; then + echo "Downloading http://$GS_URL/opnfv-gerrit-$GERRIT_CHANGE_NUMBER.properties" + # get the properties file for the Armband Fuel ISO built for a merged change + curl -s -o $WORKSPACE/latest.properties http://$GS_URL/opnfv-gerrit-$GERRIT_CHANGE_NUMBER.properties +else + # get the latest.properties file in order to get info regarding latest artifact + echo "Downloading http://$GS_URL/latest.properties" + curl -s -o $WORKSPACE/latest.properties http://$GS_URL/latest.properties +fi + +# check if we got the file +# FIXME: the file is created even if it didn't exist on the host +# We should check that the contents are sane +[[ -f latest.properties ]] || exit 1 + +# source the file so we get artifact metadata +source latest.properties + +# echo the info about artifact that is used during the deployment +OPNFV_ARTIFACT=${OPNFV_ARTIFACT_URL/*\/} +echo "Using $OPNFV_ARTIFACT for deployment" + +# using ISOs for verify & merge jobs from local storage will be enabled later +if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then + # check if we already have the ISO to avoid redownload + ISOSTORE="/iso_mount/opnfv_ci/${GIT_BRANCH##*/}" + if [[ -f "$ISOSTORE/$OPNFV_ARTIFACT" ]]; then + echo "ISO exists locally. Skipping the download and using the file from ISO store" + ln -s $ISOSTORE/$OPNFV_ARTIFACT $WORKSPACE/opnfv.iso + echo "--------------------------------------------------------" + echo + ls -al $WORKSPACE/opnfv.iso + echo + echo "--------------------------------------------------------" + echo "Done!" + exit 0 + fi +fi + +# log info to console +echo "Downloading the $INSTALLER_TYPE artifact using URL http://$OPNFV_ARTIFACT_URL" +echo "This could take some time..." +echo "--------------------------------------------------------" +echo + +# download the file +curl -s -o $WORKSPACE/opnfv.iso http://$OPNFV_ARTIFACT_URL + +# The file is always created, check that it is in fact an ISO image +[[ $(file $WORKSPACE/opnfv.iso) =~ ISO ]] + +echo +echo "--------------------------------------------------------" +echo "Done!" diff --git a/jjb/armband/armband.yml b/jjb/armband/armband-project-jobs.yml index 75c0e7a7b..b40949d27 100644 --- a/jjb/armband/armband.yml +++ b/jjb/armband/armband-project-jobs.yml @@ -9,6 +9,7 @@ jobs: - 'armband-verify-{stream}' + - 'armband-build-daily-{stream}' stream: - master: @@ -72,15 +73,11 @@ max-per-node: 1 parameters: - - project-parameters: + - project-parameter: project: '{project}' - 'arm-build1-defaults' - - choice: - name: FORCE_BUILD - choices: - - 'false' - - 'true' - description: 'Force build even if there are no changes in the armband repo. Default false' + - armband-project-parameter: + gs-pathname: '{gs-pathname}' scm: - git-scm: @@ -89,18 +86,41 @@ branch: '{branch}' triggers: - -pollscm: + - pollscm: cron: '0 H/4 * * *' wrappers: - -timeout: + - timeout: timeout: 360 fail: true builders: - shell: - !include-raw-escape: ./armband-build.sh + !include-raw-escape: ./build.sh + - shell: + !include-raw-escape: ./upload-artifacts.sh publishers: - email: recipients: josep.puigdemont@enea.com armband@enea.com + +######################## +# parameter macros +######################## +- parameter: + name: armband-project-parameter + parameters: + - string: + name: BUILD_DIRECTORY + default: $WORKSPACE/build_output + description: "Directory where the build artifact will be located upon the completion of the build." + - string: + name: GS_URL + default: artifacts.opnfv.org/$PROJECT{gs-pathname} + description: "URL to Google Storage." + - choice: + name: FORCE_BUILD + choices: + - 'false' + - 'true' + description: 'Force build even if there are no changes in the armband repo. Default false' diff --git a/jjb/armband/armband-build.sh b/jjb/armband/build.sh index 81917f6de..81917f6de 100755 --- a/jjb/armband/armband-build.sh +++ b/jjb/armband/build.sh diff --git a/jjb/armband/upload-artifacts.sh b/jjb/armband/upload-artifacts.sh new file mode 100755 index 000000000..f4e84e9d2 --- /dev/null +++ b/jjb/armband/upload-artifacts.sh @@ -0,0 +1,86 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2016 Ericsson AB 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 pipefail + +# check if we built something +if [ -f $WORKSPACE/.noupload ]; then + echo "Nothing new to upload. Exiting." + /bin/rm -f $WORKSPACE/.noupload + exit 0 +fi + +# source the opnfv.properties to get ARTIFACT_VERSION +source $WORKSPACE/opnfv.properties + +# storing ISOs for verify & merge jobs will be done once we get the disk array +if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then + # store ISO locally on NFS first + ISOSTORE="/home/jenkins/opnfv/iso_store" + if [[ -d "$ISOSTORE" ]]; then + # remove all but most recent 3 ISOs first to keep iso_mount clean & tidy + cd $ISOSTORE + ls -tp | grep -v '/' | tail -n +4 | xargs -d '\n' /bin/rm -f -- + + # store ISO + echo "Storing latest ISO in local storage" + touch .storing + /bin/cp -f $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso \ + $ISOSTORE/opnfv-$OPNFV_ARTIFACT_VERSION.iso + rm .storing + fi +fi + +# log info to console +echo "Uploading armband artifacts. This could take some time..." +echo + +echo "Started at $(date)" +cd $WORKSPACE +# upload artifact and additional files to google storage +gsutil cp $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso \ + gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1 +gsutil cp $WORKSPACE/opnfv.properties \ + gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1 +if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then + gsutil cp $WORKSPACE/opnfv.properties \ + gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1 +elif [[ "$JOB_NAME" =~ "merge" ]]; then + echo "Uploaded Armband Fuel ISO for a merged change" +fi +echo "Ended at $(date)" + +gsutil -m setmeta \ + -h "Content-Type:text/html" \ + -h "Cache-Control:private, max-age=0, no-transform" \ + gs://$GS_URL/latest.properties \ + gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > /dev/null 2>&1 + +gsutil -m setmeta \ + -h "Cache-Control:private, max-age=0, no-transform" \ + gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > /dev/null 2>&1 + +# disabled errexit due to gsutil setmeta complaints +# BadRequestException: 400 Invalid argument +# check if we uploaded the file successfully to see if things are fine +gsutil ls gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > /dev/null 2>&1 +if [[ $? -ne 0 ]]; then + echo "Problem while uploading artifact!" + echo "Check log $WORKSPACE/gsutil.iso.log on the machine where this build is done." + exit 1 +fi + +echo "Done!" +echo +echo "--------------------------------------------------------" +echo +echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso" +echo +echo "--------------------------------------------------------" +echo diff --git a/jjb/bottlenecks/bottlenecks-ci-jobs.yml b/jjb/bottlenecks/bottlenecks-ci-jobs.yml index cd1d89a5c..1109d188e 100644 --- a/jjb/bottlenecks/bottlenecks-ci-jobs.yml +++ b/jjb/bottlenecks/bottlenecks-ci-jobs.yml @@ -23,7 +23,7 @@ branch: 'stable/{stream}' gs-pathname: '/{stream}' gs-packagepath: '/{stream}/{suite}' - docker-tag: 'brahmaputra' + docker-tag: 'stable' #-------------------------------- # POD, INSTALLER, AND BRANCH MAPPING #-------------------------------- @@ -42,6 +42,9 @@ #-------------------------------- # master #-------------------------------- + - opnfv-jump-2: + installer: fuel + <<: *master - ericsson-pod1: installer: fuel <<: *master @@ -54,7 +57,7 @@ - intel-pod8: installer: compass <<: *master - - zte-build-1: + - zte-pod1: installer: fuel <<: *master - orange-pod2: @@ -114,7 +117,6 @@ builders: - 'bottlenecks-env-cleanup' - - 'bottlenecks-fetch-os-creds' - 'bottlenecks-run-suite' publishers: @@ -125,12 +127,6 @@ # builder macros ######################## - builder: - name: bottlenecks-fetch-os-creds - builders: - - shell: - !include-raw ../../utils/fetch_os_creds.sh - -- builder: name: bottlenecks-env-cleanup builders: - shell: | @@ -162,21 +158,36 @@ set -e [[ $GERRIT_REFSPEC_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null" - echo "Bottlenecks: ${SUITE_NAME} running now..." + echo "Bottlenecks: to pull image opnfv/bottlenecks:${DOCKER_TAG}" + docker pull opnfv/bottlenecks:$DOCKER_TAG >${redirect} - # pull latest image - docker pull opnfv/bottlenecks:$DOCKER_TAG >$redirect - - # run tests by using docker - opts="--privileged=true --rm" + echo "Bottlenecks: docker start running" + opts="--privileged=true -id" envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \ -e NODE_NAME=${NODE_NAME} -e EXTERNAL_NET=${EXTERNAL_NETWORK} \ -e BOTTLENECKS_BRANCH=${BOTTLENECKS_BRANCH} -e GERRIT_REFSPEC_DEBUG=${GERRIT_REFSPEC_DEBUG} \ -e BOTTLENECKS_DB_TARGET=${BOTTLENECKS_DB_TARGET} -e PACKAGE_URL=${PACKAGE_URL}" + cmd="sudo docker run ${opts} ${envs} opnfv/bottlenecks:${DOCKER_TAG} /bin/bash" + echo "Bottlenecks: docker cmd running ${cmd}" + ${cmd} >${redirect} + + echo "Bottlenecks: obtain docker id" + container_id=$(docker ps | grep "opnfv/bottlenecks:${DOCKER_TAG}" | awk '{print $1}' | head -1) + if [ -z ${container_id} ]; then + echo "Cannot find opnfv/bottlenecks container ID ${container_id}. Please check if it exists." + docker ps -a + exit 1 + fi + + echo "Bottlenecks: to prepare openstack environment" + prepare_env="${REPO_DIR}/ci/prepare_env.sh" + echo "Bottlenecks: docker cmd running: ${prepare_env}" + sudo docker exec ${container_id} ${prepare_env} + + echo "Bottlenecks: to run testsuite ${SUITE_NAME}" run_testsuite="${REPO_DIR}/run_tests.sh -s ${SUITE_NAME}" - cmd="sudo docker run ${opts} ${envs} opnfv/bottlenecks ${run_testsuite}" - echo "Bottlenecks: docker cmd running: ${cmd}" - ${cmd} + echo "Bottlenecks: docker cmd running: ${run_testsuite}" + sudo docker exec ${container_id} ${run_testsuite} #################### # parameter macros @@ -239,7 +250,7 @@ description: 'Arguments to use in order to choose the backend DB' - parameter: - name: 'bottlenecks-params-zte-build-1' + name: 'bottlenecks-params-zte-pod1' parameters: - string: name: BOTTLENECKS_DB_TARGET diff --git a/jjb/fuel/fuel-build.sh b/jjb/fuel/fuel-build.sh index eaf1f83e7..95ebaa5a9 100755 --- a/jjb/fuel/fuel-build.sh +++ b/jjb/fuel/fuel-build.sh @@ -35,11 +35,13 @@ CURRENT_SHA1=$(git rev-parse HEAD) FORCE_BUILD=${FORCE_BUILD:-false} if [[ "$CURRENT_SHA1" == "$LATEST_ISO_SHA1" && "$FORCE_BUILD" == "false" ]]; then - echo "An ISO has already been built for this commit" - echo " $LATEST_ISO_URL" - echo "Nothing new to build. Exiting." - touch $WORKSPACE/.noupload - exit 0 + echo "***************************************************" + echo " An ISO has already been built for this commit" + echo " $LATEST_ISO_URL" + echo "***************************************************" +# echo "Nothing new to build. Exiting." +# touch $WORKSPACE/.noupload +# exit 0 else echo "This commit has not been built yet or forced build! Proceeding with the build." /bin/rm -f $LATEST_ISO_PROPERTIES diff --git a/jjb/fuel/fuel-ci-jobs.yml b/jjb/fuel/fuel-ci-jobs.yml index e1816b528..77b711e74 100644 --- a/jjb/fuel/fuel-ci-jobs.yml +++ b/jjb/fuel/fuel-ci-jobs.yml @@ -278,35 +278,35 @@ - trigger: name: 'fuel-os-nosdn-nofeature-ha-ericsson-pod2-brahmaputra-trigger' triggers: - - timed: '0 12 * * *' + - timed: '' - trigger: name: 'fuel-os-odl_l2-nofeature-ha-ericsson-pod2-brahmaputra-trigger' triggers: - - timed: '0 15 * * *' + - timed: '' - trigger: name: 'fuel-os-odl_l3-nofeature-ha-ericsson-pod2-brahmaputra-trigger' triggers: - - timed: '0 18 * * *' + - timed: '' - trigger: name: 'fuel-os-onos-nofeature-ha-ericsson-pod2-brahmaputra-trigger' triggers: - - timed: '0 21 * * *' + - timed: '' - trigger: name: 'fuel-os-odl_l2-bgpvpn-ha-ericsson-pod2-brahmaputra-trigger' triggers: - - timed: '0 0 * * *' + - timed: '' - trigger: name: 'fuel-os-odl_l2-sfc-ha-ericsson-pod2-brahmaputra-trigger' triggers: - - timed: '0 3 * * *' + - timed: '' - trigger: name: 'fuel-os-nosdn-kvm-ha-ericsson-pod2-brahmaputra-trigger' triggers: - - timed: '0 6 * * *' + - timed: '' - trigger: name: 'fuel-os-nosdn-ovs-ha-ericsson-pod2-brahmaputra-trigger' triggers: - - timed: '0 9 * * *' + - timed: '' - trigger: name: 'fuel-os-nosdn-kvm-noha-ericsson-pod2-brahmaputra-trigger' triggers: diff --git a/jjb/fuel/fuel-project-jobs.yml b/jjb/fuel/fuel-project-jobs.yml index 0d768203f..f377c9bed 100755 --- a/jjb/fuel/fuel-project-jobs.yml +++ b/jjb/fuel/fuel-project-jobs.yml @@ -60,8 +60,7 @@ branch: '{branch}' triggers: - - pollscm: - cron: '0 H/4 * * *' + - timed: '0 H/4 * * *' wrappers: - timeout: diff --git a/jjb/functest/functest-ci-jobs.yml b/jjb/functest/functest-ci-jobs.yml index e2b9a1049..bbdba9fa3 100644 --- a/jjb/functest/functest-ci-jobs.yml +++ b/jjb/functest/functest-ci-jobs.yml @@ -18,7 +18,7 @@ stream: brahmaputra branch: 'stable/{stream}' gs-pathname: '/{stream}' - docker-tag: 'brahmaputra.1.0' + docker-tag: 'stable' #-------------------------------- # POD, INSTALLER, AND BRANCH MAPPING #-------------------------------- @@ -55,6 +55,9 @@ - virtual: installer: joid <<: *brahmaputra + - arm-pod1: + installer: fuel + <<: *brahmaputra #-------------------------------- # master #-------------------------------- @@ -94,6 +97,9 @@ - nokia-pod1: installer: apex <<: *master + - arm-pod1: + installer: fuel + <<: *master #-------------------------------- testsuite: @@ -191,7 +197,7 @@ description: "Push the results of all the tests to the resultDB" - string: name: CI_DEBUG - default: 'false' + default: 'true' description: "Show debug output information" ######################## # trigger macros @@ -217,11 +223,14 @@ builders: - shell: | #!/bin/bash - set +e - flags="-s" - [[ "$PUSH_RESULTS_TO_DB" == "true" ]] && flags+=" -r" - echo "Functest: run $FUNCTEST_SUITE_NAME" - cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test $FUNCTEST_SUITE_NAME ${flags}" + set -e + branch=${GIT_BRANCH##*/} + echo "Functest: run $FUNCTEST_SUITE_NAME on branch ${branch}" + if [[ ${branch} == *"brahmaputra"* ]]; then + cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test $FUNCTEST_SUITE_NAME" + else + cmd="python ${FUNCTEST_REPO_DIR}/ci/run_tests.py -t $FUNCTEST_SUITE_NAME" + fi container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1) docker exec $container_id $cmd @@ -231,9 +240,13 @@ - shell: | #!/bin/bash set +e - flags="-s" - [[ "$PUSH_RESULTS_TO_DB" == "true" ]] && flags+=" -r" - cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh ${flags}" + branch=${GIT_BRANCH##*/} + [[ "$PUSH_RESULTS_TO_DB" == "true" ]] && flags+="-r" + if [[ ${branch} == *"brahmaputra"* ]]; then + cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh -s ${flags}" + else + cmd="python ${FUNCTEST_REPO_DIR}/ci/run_tests.py -t all ${flags}" + fi container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1) docker exec $container_id $cmd @@ -242,17 +255,29 @@ builders: - shell: | #!/bin/bash - set +e + set -e [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null" # labconfig is used only for joid labconfig="" if [[ ${INSTALLER_TYPE} == 'apex' ]]; then - instack_mac=$(sudo virsh domiflist instack | grep default | \ - grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+") + if sudo virsh list | grep instack; then + instack_mac=$(sudo virsh domiflist instack | grep default | \ + grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+") + elif sudo virsh list | grep undercloud; then + instack_mac=$(sudo virsh domiflist undercloud | grep default | \ + grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+") + else + echo "No available installer VM exists...exiting" + exit 1 + fi INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk {'print $1'}) sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa" - sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable - sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable + if sudo iptables -C FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable 2> ${redirect}; then + sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable + fi + if sudo iptables -C FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable 2> ${redirect}; then + sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable + fi elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then # If production lab then creds may be retrieved dynamically # creds are on the jumphost, always in the same folder @@ -269,14 +294,15 @@ mkdir -p ${dir_result} sudo rm -rf ${dir_result}/* res_volume="-v ${dir_result}:/home/opnfv/functest/results" + custom_params= + test -f ${HOME}/opnfv/functest/custom/params_${DOCKER_TAG} && custom_params=$(cat ${HOME}/opnfv/functest/custom/params_${DOCKER_TAG}) echo "Functest: Pulling image opnfv/functest:${DOCKER_TAG}" - docker pull opnfv/functest:$DOCKER_TAG >${redirect} + docker pull opnfv/functest:$DOCKER_TAG >/dev/null - cmd="sudo docker run --privileged=true -id ${envs} ${labconfig} ${sshkey} ${res_volume} opnfv/functest:${DOCKER_TAG} /bin/bash" + cmd="sudo docker run --privileged=true -id ${envs} ${labconfig} ${sshkey} ${res_volume} ${custom_params} opnfv/functest:${DOCKER_TAG} /bin/bash" echo "Functest: Running docker run command: ${cmd}" ${cmd} >${redirect} - docker ps -a sleep 5 container_id=$(docker ps | grep "opnfv/functest:${DOCKER_TAG}" | awk '{print $1}' | head -1) echo "Container ID=${container_id}" @@ -288,12 +314,16 @@ echo "Starting the container: docker start ${container_id}" docker start ${container_id} sleep 5 - docker ps + docker ps >${redirect} if [ $(docker ps | grep "opnfv/functest:${DOCKER_TAG}" | wc -l) == 0 ]; then echo "The container opnfv/functest with ID=${container_id} has not been properly started. Exiting..." exit 1 fi - cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh" + if [[ ${branch} == *"brahmaputra"* ]]; then + cmd="${FUNCTEST_REPO_DIR}/docker/prepare_env.sh" + else + cmd="python ${FUNCTEST_REPO_DIR}/ci/prepare_env.py start" + fi echo "Executing command inside the docker: ${cmd}" docker exec ${container_id} ${cmd} @@ -320,10 +350,10 @@ # Remove existing images if exist if [[ ! -z $(docker images | grep opnfv/functest) ]]; then echo "Docker images to remove:" - docker images | head -1 && docker images | grep opnfv/functest + docker images | head -1 && docker images | grep opnfv/functest >${redirect} image_tags=($(docker images | grep opnfv/functest | awk '{print $2}')) for tag in "${image_tags[@]}"; do echo "Removing docker image opnfv/functest:$tag..." - docker rmi opnfv/functest:$tag >${redirect} + docker rmi opnfv/functest:$tag >/dev/null done fi diff --git a/jjb/joid/joid-deploy.sh b/jjb/joid/joid-deploy.sh index 59ba01588..149447733 100644 --- a/jjb/joid/joid-deploy.sh +++ b/jjb/joid/joid-deploy.sh @@ -50,8 +50,6 @@ fi case $NODE_NAME in orange-fr-pod2) POD=orange-pod2 ;; - juniper-us-test-1) - POD=juniper-pod1 ;; *virtual*) POD=default ;; *) diff --git a/jjb/opnfv/opnfv-docker.sh b/jjb/opnfv/opnfv-docker.sh index 8f44268e6..702c0ce52 100644 --- a/jjb/opnfv/opnfv-docker.sh +++ b/jjb/opnfv/opnfv-docker.sh @@ -17,6 +17,14 @@ echo "--------------------------------------------------------" echo +if [[ -n $(ps -ef|grep 'docker build'|grep -v grep) ]]; then + echo "There is already another build process in progress:" + echo $(ps -ef|grep 'docker build'|grep -v grep) + # Abort this job since it will colide and might mess up the current one. + echo "Aborting..." + exit 1 +fi + # Remove previous running containers if exist if [[ -n "$(docker ps -a | grep $DOCKER_REPO_NAME)" ]]; then echo "Removing existing $DOCKER_REPO_NAME containers..." diff --git a/jjb/opnfv/opnfv-docker.yml b/jjb/opnfv/opnfv-docker.yml index 130edd480..936f22040 100644 --- a/jjb/opnfv/opnfv-docker.yml +++ b/jjb/opnfv/opnfv-docker.yml @@ -40,7 +40,7 @@ description: "To enable/disable pushing the image to Dockerhub." - string: name: BASE_VERSION - default: "brahmaputra.1" + default: "brahmaputra.3" description: "Base version to be used." - string: name: DOCKER_REPO_NAME @@ -83,7 +83,7 @@ description: "To enable/disable pushing the image to Dockerhub." - string: name: BASE_VERSION - default: "brahmaputra.2" + default: "brahmaputra.3" description: "Base version to be used." - string: name: DOCKER_REPO_NAME diff --git a/jjb/opnfv/opnfv-docs.yml b/jjb/opnfv/opnfv-docs.yml index e5c87a64d..2b3f98a4e 100644 --- a/jjb/opnfv/opnfv-docs.yml +++ b/jjb/opnfv/opnfv-docs.yml @@ -53,7 +53,7 @@ projects: - project-compare-type: 'REG_EXP' #Left out arno projects oscar|octopus|functest|genesis - project-pattern: 'vswitchperf|apex|availability|bottlenecks|compass4nfv|conductor|copper|doctor|dovetail|dpacc|escalator|fastpathmetrics|fuel|inspector|ipv6|joid|kvmfornfv|lsoapi|moon|movie|multisite|octopus|onosfw|ovsnfv|parser|prediction|promise|qtip|releng|rs|sdnvpn|sfc|vnf_forwarding_graph|enfv|pinpoint|pharos|cperf|functest|genesisreq|models|domino|netready' + project-pattern: 'vswitchperf|apex|armband|availability|bottlenecks|compass4nfv|conductor|copper|doctor|dovetail|dpacc|escalator|fastpathmetrics|fuel|inspector|ipv6|joid|kvmfornfv|lsoapi|moon|movie|multisite|octopus|onosfw|ovsnfv|parser|prediction|promise|qtip|releng|rs|sdnvpn|sfc|vnf_forwarding_graph|enfv|pinpoint|pharos|cperf|functest|genesisreq|models|domino|netready' branches: - branch-compare-type: 'ANT' branch-pattern: '**/{branch}' @@ -91,7 +91,7 @@ comment-contains-value: 'remerge' projects: - project-compare-type: 'REG_EXP' - project-pattern: 'vswitchperf|apex|availability|bottlenecks|compass4nfv|conductor|copper|doctor|dovetail|dpacc|escalator|fastpathmetrics|fuel|inspector|ipv6|joid|kvmfornfv|lsoapi|moon|movie|multisite|octopus|onosfw|ovsnfv|parser|prediction|promise|qtip|releng|rs|sdnvpn|sfc|vnf_forwarding_graph|enfv|pinpoint|pharos|cperf|functest|genesisreq|models|domino|netready' + project-pattern: 'vswitchperf|apex|armband|availability|bottlenecks|compass4nfv|conductor|copper|doctor|dovetail|dpacc|escalator|fastpathmetrics|fuel|inspector|ipv6|joid|kvmfornfv|lsoapi|moon|movie|multisite|octopus|onosfw|ovsnfv|parser|prediction|promise|qtip|releng|rs|sdnvpn|sfc|vnf_forwarding_graph|enfv|pinpoint|pharos|cperf|functest|genesisreq|models|domino|netready' branches: - branch-compare-type: 'ANT' branch-pattern: '**/{branch}' diff --git a/jjb/opnfv/slave-params.yml b/jjb/opnfv/slave-params.yml index 2431ade85..c45ac7b2d 100644 --- a/jjb/opnfv/slave-params.yml +++ b/jjb/opnfv/slave-params.yml @@ -394,15 +394,15 @@ description: 'Git URL to use on this Jenkins Slave' - parameter: - name: 'zte-build-1-defaults' + name: 'zte-pod1-defaults' parameters: - node: name: SLAVE_NAME description: 'Slave name on Jenkins' allowed-slaves: - - zte-build-1 + - zte-pod1 default-slaves: - - zte-build-1 + - zte-pod1 - string: name: GIT_BASE default: https://gerrit.opnfv.org/gerrit/$PROJECT @@ -415,9 +415,9 @@ name: SLAVE_NAME description: 'Slave name on Jenkins' allowed-slaves: - - juniper-us-test-1 + - juniper-pod1 default-slaves: - - juniper-us-test-1 + - juniper-pod1 - string: name: INSTALLER_VERSION default: latest @@ -523,15 +523,15 @@ description: 'SSH key to use for Apex' - parameter: - name: 'dell-us-testing-bm-1-defaults' + name: 'dell-pod1-defaults' parameters: - node: name: SLAVE_NAME description: 'Slave name on Jenkins' allowed-slaves: - - dell-us-testing-bm-1 + - dell-pod1 default-slaves: - - dell-us-testing-bm-1 + - dell-pod1 - string: name: INSTALLER_VERSION default: latest @@ -542,15 +542,15 @@ description: 'Git URL to use on this Jenkins Slave' - parameter: - name: 'dell-us-deploying-bm3-defaults' + name: 'dell-pod2-defaults' parameters: - node: name: SLAVE_NAME description: 'Slave name on Jenkins' allowed-slaves: - - dell-us-deploying-bm3 + - dell-pod2 default-slaves: - - dell-us-deploying-bm3 + - dell-pod2 - string: name: INSTALLER_VERSION default: latest @@ -597,3 +597,30 @@ name: GIT_BASE default: https://gerrit.opnfv.org/gerrit/$PROJECT description: 'Git URL to use on this Jenkins Slave' + +- parameter: + name: 'arm-pod1-defaults' + parameters: + - node: + name: SLAVE_NAME + description: 'Slave name on Jenkins' + allowed-slaves: + - arm-pod1 + default-slaves: + - arm-pod1 + - string: + name: GIT_BASE + default: https://gerrit.opnfv.org/gerrit/$PROJECT + description: 'Git URL to use on this Jenkins Slave' + - string: + name: DEFAULT_BRIDGE + default: 'admin6_br0,public6_br0' + desciption: 'The bridge to use for Fuel PXE booting. It can be a comma sparated list of bridges, in which case the first is the PXE boot bridge, and all subsequent interfaces that will be added to the VM. If left empty, most deploy scripts will default to pxebr.' + - string: + name: DEPLOY_TIMEOUT + default: '360' + description: 'Deployment timeout in minutes' + - string: + name: LAB_CONFIG_URL + default: file://$HOME/opnfv/repos/lab-config + description: 'Base URI to the configuration directory' diff --git a/jjb/ovsnfv/ovsnfv.yml b/jjb/ovsnfv/ovsnfv.yml index 8a119d9fb..6f6d29012 100644 --- a/jjb/ovsnfv/ovsnfv.yml +++ b/jjb/ovsnfv/ovsnfv.yml @@ -85,6 +85,11 @@ refspec: '' choosing-strategy: 'default' + wrappers: + - timeout: + timeout: 24 + fail: true + triggers: - gerrit: trigger-on: @@ -126,6 +131,11 @@ refspec: '' branch: '{branch}' + wrappers: + - timeout: + timeout: 24 + fail: true + triggers: - timed: '@midnight' @@ -138,3 +148,7 @@ cd $WORKSPACE/ci ./build.sh + + publishers: + - email: + recipients: therbert@redhat.com mark.d.gray@intel.com billy.o.mahony@intel.com diff --git a/jjb/qtip/qtip-ci-jobs.yml b/jjb/qtip/qtip-ci-jobs.yml index 8dd0a4af0..5d4eeac8b 100644 --- a/jjb/qtip/qtip-ci-jobs.yml +++ b/jjb/qtip/qtip-ci-jobs.yml @@ -23,19 +23,14 @@ # brahmaputra #-------------------------------- pod: - - dell-us-testing-bm-1: + - dell-pod1: installer: compass - auto-trigger-name: 'qtip-daily-dell-us-testing-bm-1-trigger' + auto-trigger-name: 'qtip-daily-dell-pod1-trigger' <<: *brahmaputra - orange-pod2: installer: joid auto-trigger-name: 'brahmaputra-trigger-daily-disabled' <<: *brahmaputra - - dell-us-deploying-bm3: - installer: fuel - auto-trigger-name: 'qtip-daily-dell-us-deploying-bm3-trigger' - <<: *brahmaputra - #-------------------------------- # master #-------------------------------- @@ -43,7 +38,7 @@ installer: joid <<: *master auto-trigger-name: 'brahmaputra-trigger-daily-disabled' -# - zte-build-1: #would be confirmed with the ZTE lab by tomorrow +# - zte-pod1: #would be confirmed with the ZTE lab by tomorrow # installer: fuel # <<: *master @@ -171,17 +166,12 @@ ################# - trigger: - name: 'qtip-daily-dell-us-deploying-bm3-trigger' - triggers: - - timed: '0 0 * * *' - -- trigger: - name: 'qtip-daily-dell-us-testing-bm-1-trigger' + name: 'qtip-daily-dell-pod1-trigger' triggers: - timed: '0 3 * * *' #- trigger: -# name: 'qtip-daily-juniper-build1-trigger' +# name: 'qtip-daily-juniper-pod1-trigger' # triggers: # - timed : '0 0 * * *' diff --git a/jjb/releng-defaults.yaml b/jjb/releng-defaults.yaml index 2b927d270..bf3330657 100644 --- a/jjb/releng-defaults.yaml +++ b/jjb/releng-defaults.yaml @@ -4,8 +4,8 @@ name: global logrotate: - daysToKeep: 30 - numToKeep: 100 + daysToKeep: 60 + numToKeep: 200 artifactDaysToKeep: 30 artifactNumToKeep: 100 diff --git a/jjb/releng-macros.yaml b/jjb/releng-macros.yaml index 23d174a26..7fb4d653d 100644 --- a/jjb/releng-macros.yaml +++ b/jjb/releng-macros.yaml @@ -339,11 +339,27 @@ # generate and upload lint log echo "Running flake8 code on $PROJECT ..." - echo -e "Flake8 Violations\n-----------------" >> lint.log - find . \ + # Get number of flake8 violations. If none, this will be an + # empty string: "" + FLAKE_COUNT="$(find . \ -path './releng_flake8' -prune -o \ -type f -name "*.py" -print | \ - xargs flake8 --exit-zero --first >> lint.log + xargs flake8 --exit-zero -qq --count 2>&1)" + + if [ ! -z $FLAKE_COUNT ]; then + echo "Flake8 Violations: $FLAKE_COUNT" >> lint.log + find . \ + -path './releng_flake8' -prune -o \ + -type f -name "*.py" -print | \ + xargs flake8 --exit-zero --first >> violation.log + SHOWN=$(wc -l violation.log | cut -d' ' -f1) + echo -e "First $SHOWN shown\n---" >> lint.log + cat violation.log >> lint.log + sed -r -i '4,$s/^/ /g' lint.log + rm violation.log + else + echo -e "Flake8 Violations: 0" > lint.log + fi deactivate @@ -357,7 +373,6 @@ set -o xtrace export PATH=$PATH:/usr/local/bin/ if [[ -e lint.log ]] ; then - sed -r -i 's/^/ /g' lint.log echo -e "\nposting linting report to gerrit...\n" cat lint.log echo diff --git a/jjb/yardstick/yardstick-ci-jobs.yml b/jjb/yardstick/yardstick-ci-jobs.yml index 57aa29c54..82b1a2367 100644 --- a/jjb/yardstick/yardstick-ci-jobs.yml +++ b/jjb/yardstick/yardstick-ci-jobs.yml @@ -108,10 +108,10 @@ suite: daily auto-trigger-name: 'brahmaputra-trigger-daily-disabled' <<: *master - - zte-build-1: + - zte-pod1: installer: fuel suite: daily - auto-trigger-name: 'yardstick-daily-zte-build-1-trigger' + auto-trigger-name: 'yardstick-daily-zte-pod1-trigger' <<: *master - orange-pod2: installer: joid @@ -387,7 +387,7 @@ description: 'Arguments to use in order to choose the backend DB' - parameter: - name: 'yardstick-params-zte-build-1' + name: 'yardstick-params-zte-pod1' parameters: - string: name: YARDSTICK_DB_BACKEND @@ -439,7 +439,7 @@ ####################### # trigger for PODs to only run yardstick test suites - trigger: - name: 'yardstick-daily-zte-build-1-trigger' + name: 'yardstick-daily-zte-pod1-trigger' triggers: - timed: '0 2 * * *' @@ -456,4 +456,4 @@ - trigger: name: 'yardstick-daily-huawei-sh-pod6-trigger' triggers: - - timed: '0 1 * * *'
\ No newline at end of file + - timed: '0 1 * * *' diff --git a/utils/calculate_version.sh b/utils/calculate_version.sh index 4bfd13f7a..608a3bd73 100755 --- a/utils/calculate_version.sh +++ b/utils/calculate_version.sh @@ -36,14 +36,15 @@ function docker_version() { tag_json=$(curl $url_tag 2>/dev/null | python -mjson.tool | grep ${BASE_VERSION} | head -1) #e.g. tag_json= "name": "brahmaputra.0.2", if [ "${tag_json}" == "" ]; then - error "The Docker Image ${docker_image} does not have a TAG with base version ${BASE_VERSION}" + echo ${BASE_VERSION}.0 + else + tag=$(echo $tag_json | awk '{print $2}' | sed 's/\,//' | sed 's/\"//g') + #e.g.: tag=brahmaputra.0.2 + tag_current_version=$(echo $tag | sed 's/.*\.//') + tag_new_version=$(($tag_current_version+1)) + #e.g.: tag=brahmaputra.0.3 + echo ${BASE_VERSION}.${tag_new_version} fi - tag=$(echo $tag_json | awk '{print $2}' | sed 's/\,//' | sed 's/\"//g') - #e.g.: tag=brahmaputra.0.2 - tag_current_version=$(echo $tag | sed 's/.*\.//') - tag_new_version=$(($tag_current_version+1)) - #e.g.: tag=brahmaputra.0.3 - echo ${BASE_VERSION}.${tag_new_version} } diff --git a/utils/test/dashboard/js/opnfv_dashboard_tests_conf.js b/utils/test/dashboard/js/opnfv_dashboard_tests_conf.js index 6778332eb..4d909c883 100644 --- a/utils/test/dashboard/js/opnfv_dashboard_tests_conf.js +++ b/utils/test/dashboard/js/opnfv_dashboard_tests_conf.js @@ -56,13 +56,13 @@ var opnfv_dashboard_testcases = { var opnfv_dashboard_installers_pods = {};
opnfv_dashboard_installers_pods['apex'] = ['all','intel-pod7','opnfv-jump-1'];
opnfv_dashboard_installers_pods['compass'] = ['all','huawei-us-deploy-bare-1','huawei-us-deploy-vm-1','huawei-us-deploy-vm2','intel-pod8'];
-opnfv_dashboard_installers_pods['fuel'] = ['all','ericsson-pod2','opnfv-jump-2'];
+opnfv_dashboard_installers_pods['fuel'] = ['all','ericsson-pod2','opnfv-jump-2','arm-pod1'];
opnfv_dashboard_installers_pods['joid'] = ['all','intel-pod5','intel-pod6','orange-fr-pod2'];
var opnfv_dashboard_installers_pods_print = {};
opnfv_dashboard_installers_pods_print['apex'] = ['all','intelpod7','opnfvjump1'];
opnfv_dashboard_installers_pods_print['compass'] = ['all','hwusbare1','hwusvm1','hwusvm2','intelpod8'];
-opnfv_dashboard_installers_pods_print['fuel'] = ['all','ericssonpod2','opnfvjump2'];
+opnfv_dashboard_installers_pods_print['fuel'] = ['all','ericssonpod2','opnfvjump2','armpod1'];
opnfv_dashboard_installers_pods_print['joid'] = ['all','intelpod5','intelpod6','orangefrpod2'];
var opnfv_dashboard_file_directory = 'res-test';
diff --git a/utils/test/reporting/default.css b/utils/test/reporting/functest/default.css index 0e330e965..0e330e965 100644 --- a/utils/test/reporting/default.css +++ b/utils/test/reporting/functest/default.css diff --git a/utils/test/reporting/functest/img/icon-nok.png b/utils/test/reporting/functest/img/icon-nok.png Binary files differnew file mode 100644 index 000000000..526b5294b --- /dev/null +++ b/utils/test/reporting/functest/img/icon-nok.png diff --git a/utils/test/reporting/functest/img/icon-ok.png b/utils/test/reporting/functest/img/icon-ok.png Binary files differnew file mode 100644 index 000000000..3a9de2e89 --- /dev/null +++ b/utils/test/reporting/functest/img/icon-ok.png diff --git a/utils/test/reporting/img/weather-clear.png b/utils/test/reporting/functest/img/weather-clear.png Binary files differindex a0d967750..a0d967750 100644 --- a/utils/test/reporting/img/weather-clear.png +++ b/utils/test/reporting/functest/img/weather-clear.png diff --git a/utils/test/reporting/img/weather-few-clouds.png b/utils/test/reporting/functest/img/weather-few-clouds.png Binary files differindex acfa78398..acfa78398 100644 --- a/utils/test/reporting/img/weather-few-clouds.png +++ b/utils/test/reporting/functest/img/weather-few-clouds.png diff --git a/utils/test/reporting/img/weather-overcast.png b/utils/test/reporting/functest/img/weather-overcast.png Binary files differindex 4296246d0..4296246d0 100644 --- a/utils/test/reporting/img/weather-overcast.png +++ b/utils/test/reporting/functest/img/weather-overcast.png diff --git a/utils/test/reporting/img/weather-storm.png b/utils/test/reporting/functest/img/weather-storm.png Binary files differindex 956f0e20f..956f0e20f 100644 --- a/utils/test/reporting/img/weather-storm.png +++ b/utils/test/reporting/functest/img/weather-storm.png diff --git a/utils/test/reporting/index.html b/utils/test/reporting/functest/index.html index af4033567..af4033567 100644 --- a/utils/test/reporting/index.html +++ b/utils/test/reporting/functest/index.html diff --git a/utils/test/reporting/reporting-status.py b/utils/test/reporting/functest/reporting-status.py index e15bac9f7..9271717bb 100644 --- a/utils/test/reporting/reporting-status.py +++ b/utils/test/reporting/functest/reporting-status.py @@ -1,9 +1,11 @@ from urllib2 import Request, urlopen, URLError +import datetime import json import jinja2 import os import re import requests +import sys import time import yaml @@ -12,18 +14,21 @@ functest_test_list = ['vPing', 'vPing_userdata', 'Tempest', 'Rally', 'ODL', 'ONOS', 'vIMS'] # functest_test_list = ['vPing'] -# functest_test_list = [] companion_test_list = ['doctor/doctor-notification', 'promise/promise'] # companion_test_list = [] installers = ["apex", "compass", "fuel", "joid"] -# installers = ["apex"] +# installers = ["fuel"] +versions = ["brahmaputra", "master"] +# versions = ["master"] PERIOD = 10 +MAX_SCENARIO_CRITERIA = 18 # Correspondance between the name of the test case and the name in the DB # ideally we should modify the DB to avoid such interface.... # '<name in the DB':'<name in the config'> # I know it is uggly... -test_match_matrix = {'vPing': 'vping_ssh', +test_match_matrix = {'healthcheck': 'healthcheck', + 'vPing': 'vping_ssh', 'vPing_userdata': 'vping_userdata', 'ODL': 'odl', 'ONOS': 'onos', @@ -100,7 +105,21 @@ class TestCase(object): self.isRunnable = is_runnable -def getApiResults(case, installer, scenario): +class ScenarioResult(object): + def __init__(self, status, score=0): + self.status = status + self.score = score + + def getStatus(self): + return self.status + + def getScore(self): + return self.score + +# ***************************************************************************** + + +def getApiResults(case, installer, scenario, version): case = case.getName() results = json.dumps([]) # to remove proxy (to be removed at the end for local test only) @@ -109,9 +128,9 @@ def getApiResults(case, installer, scenario): # urllib2.install_opener(opener) # url = "http://127.0.0.1:8000/results?case=" + case + \ # "&period=30&installer=" + installer - url = "http://testresults.opnfv.org/testapi/results?case=" + case + \ - "&period=" + str(PERIOD) + "&installer=" + installer + \ - "&scenario=" + scenario + url = ("http://testresults.opnfv.org/testapi/results?case=" + case + + "&period=" + str(PERIOD) + "&installer=" + installer + + "&scenario=" + scenario + "&version=" + version) request = Request(url) try: @@ -124,11 +143,12 @@ def getApiResults(case, installer, scenario): return results -def getScenarios(case, installer): +def getScenarios(case, installer, version): case = case.getName() url = "http://testresults.opnfv.org/testapi/results?case=" + case + \ - "&period=" + str(PERIOD) + "&installer=" + installer + "&period=" + str(PERIOD) + "&installer=" + installer + \ + "&version=" + version request = Request(url) try: @@ -147,9 +167,9 @@ def getScenarios(case, installer): for r in test_results: # Retrieve all the scenarios per installer - if not r['version'] in scenario_results.keys(): - scenario_results[r['version']] = [] - scenario_results[r['version']].append(r) + if not r['scenario'] in scenario_results.keys(): + scenario_results[r['scenario']] = [] + scenario_results[r['scenario']].append(r) return scenario_results @@ -174,10 +194,10 @@ def getNbtestOk(results): return nb_test_ok -def getResult(testCase, installer, scenario): +def getResult(testCase, installer, scenario, version): # retrieve raw results - results = getApiResults(testCase, installer, scenario) + results = getApiResults(testCase, installer, scenario, version) # let's concentrate on test results only test_results = results['test_results'] @@ -230,77 +250,114 @@ def getResult(testCase, installer, scenario): # ****************************************************************************** # ****************************************************************************** -# as the criteria are all difference, we shall use a common way to indicate -# the criteria -# 100 = 100% = all the test must be OK -# 90 = 90% = all the test must be above 90% of success rate -# TODO harmonize success criteria -# some criteria could be the duration, the success rate, the packet loss,... -# to be done case by case -# TODo create TestCriteria Object - - # init just tempest to get the list of scenarios # as all the scenarios run Tempest tempest = TestCase("Tempest", "functest", -1) # Retrieve the Functest configuration to detect which tests are relevant # according to the installer, scenario -response = requests.get('https://git.opnfv.org/cgit/functest/plain/testcases/config_functest.yaml') +cf = "https://git.opnfv.org/cgit/functest/plain/ci/config_functest.yaml" +response = requests.get(cf) functest_yaml_config = yaml.load(response.text) print "****************************************" print "* Generating reporting..... *" +print ("* Data retention = %s days *" % PERIOD) +print "* *" print "****************************************" -# For all the installers -for installer in installers: - # get scenarios - scenario_results = getScenarios(tempest, installer) - scenario_stats = getScenarioStats(scenario_results) - - items = {} - # For all the scenarios get results - for s, s_result in scenario_results.items(): - testCases = [] - # For each scenario declare the test cases - # Functest cases - for test_case in functest_test_list: - testCases.append(TestCase(test_case, "functest")) - - # project/case - for test_case in companion_test_list: - test_split = test_case.split("/") - test_project = test_split[0] - test_case = test_split[1] - testCases.append(TestCase(test_case, test_project)) - - # Check if test case is runnable according to the installer, scenario - for test_case in testCases: - test_case.checkRunnable(installer, s, functest_yaml_config) - # print "testcase %s is %s" % (test_case.getName(), - # test_case.isRunnable) - - print "--------------------------" - print "%s / %s:" % (installer, s) - for testCase in testCases: - time.sleep(1) - if testCase.isRunnable: - print " Searching results for case %s " % testCase.getName() - result = getResult(testCase, installer, s) - testCase.setCriteria(result) - items[s] = testCases - print "--------------------------" - print "****************************************" - templateLoader = jinja2.FileSystemLoader(os.path.dirname(os.path.abspath(__file__))) - templateEnv = jinja2.Environment(loader=templateLoader) - - TEMPLATE_FILE = "index-status-tmpl.html" - template = templateEnv.get_template(TEMPLATE_FILE) - - outputText = template.render(scenario_stats=scenario_stats, - items=items, - installer=installer, - period=PERIOD) - - with open("index-status-" + installer + ".html", "wb") as fh: - fh.write(outputText) + +# For all the versions +for version in versions: + # For all the installers + for installer in installers: + # get scenarios + scenario_results = getScenarios(tempest, installer, version) + scenario_stats = getScenarioStats(scenario_results) + items = {} + scenario_result_criteria = {} + + # For all the scenarios get results + for s, s_result in scenario_results.items(): + testCases = [] + # Green or Red light for a given scenario + nb_test_runnable_for_this_scenario = 0 + scenario_score = 0 + + # For each scenario declare the test cases + # Functest cases + for test_case in functest_test_list: + testCases.append(TestCase(test_case, "functest")) + + # project/case + for test_case in companion_test_list: + test_split = test_case.split("/") + test_project = test_split[0] + test_case = test_split[1] + testCases.append(TestCase(test_case, test_project)) + + # Check if test case is runnable / installer, scenario + try: + for test_case in testCases: + test_case.checkRunnable(installer, s, functest_yaml_config) + # print "testcase %s is %s" % (test_case.getName(), + # test_case.isRunnable) + print ("installer %s, version %s, scenario %s:" % + (installer, version, s)) + for testCase in testCases: + time.sleep(1) + if testCase.isRunnable: + nb_test_runnable_for_this_scenario += 1 + print (" Searching results for case %s " % + (testCase.getName())) + result = getResult(testCase, installer, s, version) + testCase.setCriteria(result) + items[s] = testCases + scenario_score = scenario_score + result + except: + print ("installer %s, version %s, scenario %s" % + (installer, version, s)) + print "No data available , error %s " % (sys.exc_info()[0]) + + # the validation criteria = nb runnable tests x 3 + scenario_criteria = nb_test_runnable_for_this_scenario * 3 + # if 0 runnable tests set criteria at a high value + if scenario_criteria < 1: + scenario_criteria = MAX_SCENARIO_CRITERIA + + s_score = str(scenario_score) + "/" + str(scenario_criteria) + s_status = "KO" + if scenario_score < scenario_criteria: + print (">>>> scenario not OK, score = %s/%s" % + (scenario_score, scenario_criteria)) + s_status = "KO" + else: + print ">>>>> scenario OK, save the information" + s_status = "OK" + with open("./release/" + version + + "/validated_scenario_history.txt", "a") as f: + time_format = "%Y-%m-%d %H:%M" + info = (datetime.datetime.now().strftime(time_format) + + ";" + installer + ";" + s + "\n") + f.write(info) + + scenario_result_criteria[s] = ScenarioResult(s_status, s_score) + print "--------------------------" + + templateLoader = jinja2.FileSystemLoader(os.path.dirname + (os.path.abspath + (__file__))) + templateEnv = jinja2.Environment(loader=templateLoader) + + TEMPLATE_FILE = "./template/index-status-tmpl.html" + template = templateEnv.get_template(TEMPLATE_FILE) + + outputText = template.render(scenario_stats=scenario_stats, + scenario_results=scenario_result_criteria, + items=items, + installer=installer, + period=PERIOD, + version=version) + + with open("./release/" + version + + "/index-status-" + installer + ".html", "wb") as fh: + fh.write(outputText) diff --git a/utils/test/reporting/reporting-tempest.py b/utils/test/reporting/functest/reporting-tempest.py index 944b42809..563e53010 100644 --- a/utils/test/reporting/reporting-tempest.py +++ b/utils/test/reporting/functest/reporting-tempest.py @@ -88,12 +88,12 @@ for installer in installers: templateLoader = jinja2.FileSystemLoader(os.path.dirname(os.path.abspath(__file__))) templateEnv = jinja2.Environment(loader=templateLoader) - TEMPLATE_FILE = "index-tempest-tmpl.html" + TEMPLATE_FILE = "./template/index-tempest-tmpl.html" template = templateEnv.get_template(TEMPLATE_FILE) outputText = template.render(scenario_results=scenario_results, items=items, installer=installer) - with open("index-tempest-" + installer + ".html", "wb") as fh: + with open("./release/index-tempest-" + installer + ".html", "wb") as fh: fh.write(outputText) diff --git a/utils/test/reporting/reporting-vims.py b/utils/test/reporting/functest/reporting-vims.py index cf43f3ebc..78ca9f5b3 100644 --- a/utils/test/reporting/reporting-vims.py +++ b/utils/test/reporting/functest/reporting-vims.py @@ -72,12 +72,12 @@ for installer in installers: templateLoader = jinja2.FileSystemLoader(os.path.dirname(os.path.abspath(__file__))) templateEnv = jinja2.Environment( loader=templateLoader ) - TEMPLATE_FILE = "index-vims-tmpl.html" + TEMPLATE_FILE = "./template/index-vims-tmpl.html" template = templateEnv.get_template( TEMPLATE_FILE ) outputText = template.render( scenario_results = scenario_results, step_order = step_order, installer = installer) - with open("index-vims" + installer + ".html", "wb") as fh: + with open("./release/index-vims" + installer + ".html", "wb") as fh: fh.write(outputText) diff --git a/utils/test/reporting/index-status-tmpl.html b/utils/test/reporting/functest/template/index-status-tmpl.html index 0fd470d6f..7a0656b74 100644 --- a/utils/test/reporting/index-status-tmpl.html +++ b/utils/test/reporting/functest/template/index-status-tmpl.html @@ -18,7 +18,7 @@ <body> <div class="container"> <div class="masthead"> - <h3 class="text-muted">Functest status page</h3> + <h3 class="text-muted">Functest status page ({{version}})</h3> <nav> <ul class="nav nav-justified"> <li class="active"><a href="index.html">Home</a></li> @@ -37,15 +37,23 @@ </div> <div class="scenario-overview"> - <div class="panel-heading"><h4><b>List of last scenarios run over the last {{period}} days </b></h4></div> + <div class="panel-heading"><h4><b>List of last scenarios ({{version}}) run over the last {{period}} days </b></h4></div> <table class="table"> <tr> - <th width="80%">Scenario</th> - <th width="20%">Iteration</th> + <th width="60%">Scenario</th> + <th width="20%">Status</th> + <th width="10%">Score</th> + <th width="10%">Iteration</th> </tr> {% for scenario,iteration in scenario_stats.iteritems() -%} <tr class="tr-ok"> <td>{{scenario}}</td> + <td>{%if scenario_results[scenario].getStatus() is sameas "OK" -%} + <img src="../../img/icon-ok.png"> + {%- else -%} + <img src="../../img/icon-nok.png"> + {%- endif %}</td> + <td>{{scenario_results[scenario].getScore()}}</td> <td>{{iteration}}</td> </tr> {%- endfor %} @@ -53,7 +61,6 @@ </div> - {% for scenario, iteration in scenario_stats.iteritems() -%} <div class="scenario-part"> <div class="page-header"> @@ -75,13 +82,13 @@ {% if test.isRunnable is sameas false -%} <td>N.R</td> {% elif test.getCriteria() > 2 -%} - <td><img src="./img/weather-clear.png"></td> + <td><img src="../../img/weather-clear.png"></td> {%- elif test.getCriteria() > 1 -%} - <td><img src="./img/weather-few-clouds.png"></td> + <td><img src="../../img/weather-few-clouds.png"></td> {%- elif test.getCriteria() > 0 -%} - <td><img src="./img/weather-overcast.png"></td> + <td><img src="../../img/weather-overcast.png"></td> {%- else -%} - <td><img src="./img/weather-storm.png"></td> + <td><img src="../../img/weather-storm.png"></td> {%- endif %} {%- endfor %} </tr> diff --git a/utils/test/reporting/index-tempest-tmpl.html b/utils/test/reporting/functest/template/index-tempest-tmpl.html index be0b79734..be0b79734 100644 --- a/utils/test/reporting/index-tempest-tmpl.html +++ b/utils/test/reporting/functest/template/index-tempest-tmpl.html diff --git a/utils/test/reporting/index-vims-tmpl.html b/utils/test/reporting/functest/template/index-vims-tmpl.html index 8858182c1..8858182c1 100644 --- a/utils/test/reporting/index-vims-tmpl.html +++ b/utils/test/reporting/functest/template/index-vims-tmpl.html diff --git a/utils/test/result_collection_api/dashboard/functest2Dashboard.py b/utils/test/result_collection_api/dashboard/functest2Dashboard.py index a2ed3085c..379b93279 100644 --- a/utils/test/result_collection_api/dashboard/functest2Dashboard.py +++ b/utils/test/result_collection_api/dashboard/functest2Dashboard.py @@ -117,12 +117,15 @@ def format_vIMS_for_dashboard(results): # Calculate nb of tests run and nb of tests failed # vIMS_results = get_vIMSresults(vIMS_test) # print vIMS_results - if data_test['result'] == "Passed": - nbTests += 1 - elif data_test['result'] == "Failed": - nbFailures += 1 - elif data_test['result'] == "Skipped": - nbSkipped += 1 + try: + if data_test['result'] == "Passed": + nbTests += 1 + elif data_test['result'] == "Failed": + nbFailures += 1 + elif data_test['result'] == "Skipped": + nbSkipped += 1 + except: + nbTests = 0 new_element.append({'x': data['creation_date'], 'y1': nbTests, @@ -149,10 +152,13 @@ def format_vIMS_for_dashboard(results): nbTestsOK = 0 nbTestsKO = 0 - if data_test['result'] == "Passed": - nbTestsOK += 1 - elif data_test['result'] == "Failed": - nbTestsKO += 1 + try: + if data_test['result'] == "Passed": + nbTestsOK += 1 + elif data_test['result'] == "Failed": + nbTestsKO += 1 + except: + nbTestsOK = 0 nbTests += nbTestsOK + nbTestsKO nbFailures += nbTestsKO @@ -366,7 +372,7 @@ def format_Rally_for_dashboard(results): # ******************************** new_element = [] for data in results: - summary_cursor = len(data) + summary_cursor = len(data['details']) - 1 new_element.append({'x': data['creation_date'], 'y': int(data['details'][summary_cursor]['summary']['duration'])}) diff --git a/utils/test/result_collection_api/resources/handlers.py b/utils/test/result_collection_api/resources/handlers.py index 1eda3b067..c1e8eb182 100644 --- a/utils/test/result_collection_api/resources/handlers.py +++ b/utils/test/result_collection_api/resources/handlers.py @@ -512,6 +512,8 @@ class TestResultsHandler(GenericApiHandler): - period : x (x last days) - scenario : the test scenario (previously version) - criteria : the global criteria status passed or failed + - trust_indicator : evaluate the stability of the test case to avoid + running systematically long and stable test case :param result_id: Get a result by ID @@ -531,6 +533,7 @@ class TestResultsHandler(GenericApiHandler): scenario_arg = self.get_query_argument("scenario", None) criteria_arg = self.get_query_argument("criteria", None) period_arg = self.get_query_argument("period", None) + trust_indicator_arg = self.get_query_argument("trust_indicator", None) # prepare request get_request = dict() @@ -559,6 +562,9 @@ class TestResultsHandler(GenericApiHandler): if criteria_arg is not None: get_request["criteria_tag"] = criteria_arg + if trust_indicator_arg is not None: + get_request["trust_indicator_arg"] = trust_indicator_arg + if period_arg is not None: try: period_arg = int(period_arg) diff --git a/utils/test/result_collection_api/resources/models.py b/utils/test/result_collection_api/resources/models.py index 35b6af11f..06e95f94f 100644 --- a/utils/test/result_collection_api/resources/models.py +++ b/utils/test/result_collection_api/resources/models.py @@ -153,6 +153,7 @@ class TestResult: self.build_tag = None
self.scenario = None
self.criteria = None
+ self.trust_indicator = None
@staticmethod
def test_result_from_dict(test_result_dict):
@@ -173,7 +174,21 @@ class TestResult: t.build_tag = test_result_dict.get('build_tag')
t.scenario = test_result_dict.get('scenario')
t.criteria = test_result_dict.get('criteria')
-
+ # 0 < trust indicator < 1
+ # if bad value => set this indicator to 0
+ if test_result_dict.get('trust_indicator') is not None:
+ if isinstance(test_result_dict.get('trust_indicator'),
+ (int, long, float)):
+ if test_result_dict.get('trust_indicator') < 0:
+ t.trust_indicator = 0
+ elif test_result_dict.get('trust_indicator') > 1:
+ t.trust_indicator = 1
+ else:
+ t.trust_indicator = test_result_dict.get('trust_indicator')
+ else:
+ t.trust_indicator = 0
+ else:
+ t.trust_indicator = 0
return t
def format(self):
@@ -188,7 +203,8 @@ class TestResult: "details": self.details,
"build_tag": self.build_tag,
"scenario": self.scenario,
- "criteria": self.criteria
+ "criteria": self.criteria,
+ "trust_indicator": self.trust_indicator
}
def format_http(self):
@@ -204,6 +220,6 @@ class TestResult: "details": self.details,
"build_tag": self.build_tag,
"scenario": self.scenario,
- "criteria": self.criteria
+ "criteria": self.criteria,
+ "trust_indicator": self.trust_indicator
}
-
|