From: Ryota Mibu Date: Tue, 4 Jul 2017 13:19:36 +0000 (+0000) Subject: Merge "add zte-virtul3 and zte-virtul4 to Doctor CI pods" X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=0c1d6689656da269d9020e55e81f215d6f5a05a2;hp=7f1c9abc42ab1a0a4dcd50926ecac8a57dd827eb;p=releng.git Merge "add zte-virtul3 and zte-virtul4 to Doctor CI pods" --- diff --git a/jjb/compass4nfv/compass-ci-jobs.yml b/jjb/compass4nfv/compass-ci-jobs.yml index 24724912a..f8c8a31a4 100644 --- a/jjb/compass4nfv/compass-ci-jobs.yml +++ b/jjb/compass4nfv/compass-ci-jobs.yml @@ -182,6 +182,7 @@ WED: true FRI: true SUN: true + use-build-time: true steps: - trigger-builds: - project: 'dovetail-compass-{pod}-proposed_tests-master' @@ -206,9 +207,10 @@ - condition-kind: day-of-week day-selector: select-days days: - TUE: true - THU: true + TUES: true + THURS: true SAT: true + use-build-time: true steps: - trigger-builds: - project: 'dovetail-compass-{pod}-proposed_tests-danube' @@ -225,7 +227,7 @@ condition-kind: and condition-operands: - condition-kind: regex-match - regex: os-(nosdn|odl_l2)-(nofeature|bgpvpn)-ha + regex: os-(nosdn|odl_l2|onos|odl_l3)-nofeature-ha label: '{scenario}' - condition-kind: regex-match regex: master diff --git a/jjb/dovetail/dovetail-ci-jobs.yml b/jjb/dovetail/dovetail-ci-jobs.yml index 6bcaea26f..43978f6dc 100644 --- a/jjb/dovetail/dovetail-ci-jobs.yml +++ b/jjb/dovetail/dovetail-ci-jobs.yml @@ -25,7 +25,7 @@ branch: 'stable/{stream}' dovetail-branch: master gs-pathname: '/{stream}' - docker-tag: 'cvp.0.1.0' + docker-tag: 'cvp.0.2.0' #----------------------------------- # POD, PLATFORM, AND BRANCH MAPPING diff --git a/jjb/releng/testapi-automate.yml b/jjb/releng/automate.yml similarity index 78% rename from jjb/releng/testapi-automate.yml rename to jjb/releng/automate.yml index dd76538a3..9eb281de3 100644 --- a/jjb/releng/testapi-automate.yml +++ b/jjb/releng/automate.yml @@ -1,20 +1,22 @@ - project: - name: testapi-automate + name: utils-automate stream: - master: branch: '{stream}' - gs-pathname: '' + + module: + - 'testapi' + - 'reporting' phase: - - 'docker-update' - 'docker-deploy': slave-label: 'testresults' - 'generate-doc' jobs: - - 'testapi-automate-{stream}' - - 'testapi-automate-{phase}-{stream}' - - 'testapi-verify-{stream}' + - '{module}-automate-{stream}' + - '{module}-automate-{phase}-{stream}' + - '{module}-verify-{stream}' project: 'releng' @@ -44,7 +46,7 @@ - mongodb-backup - job-template: - name: 'testapi-verify-{stream}' + name: '{module}-verify-{stream}' parameters: - project-parameter: @@ -76,10 +78,11 @@ branch-pattern: '**/{branch}' file-paths: - compare-type: 'ANT' - pattern: 'utils/test/testapi/**' + pattern: 'utils/test/{module}/**' builders: - - run-unit-tests + - shell: | + bash ./utils/test/{module}/run_test.sh publishers: - junit: @@ -101,7 +104,7 @@ failing: 30 - job-template: - name: 'testapi-automate-{stream}' + name: '{module}-automate-{stream}' project-type: multijob @@ -118,8 +121,12 @@ branch: '{branch}' - string: name: DOCKER_TAG - default: "latest" - description: "Tag name for testapi docker image" + default: 'latest' + description: 'Tag name for {module} docker image' + - string: + name: MODULE_NAME + default: '{module}' + description: "Name of the module" - 'opnfv-build-defaults' scm: @@ -146,24 +153,17 @@ branch-pattern: '**/{branch}' file-paths: - compare-type: 'ANT' - pattern: 'utils/test/testapi/**' + pattern: 'utils/test/{module}/**' builders: - description-setter: description: "Built on $NODE_NAME" - - multijob: - name: docker-update - condition: SUCCESSFUL - projects: - - name: 'testapi-automate-docker-update-{stream}' - current-parameters: true - kill-phase-on: FAILURE - abort-all-job: true + - docker-update - multijob: name: docker-deploy condition: SUCCESSFUL projects: - - name: 'testapi-automate-docker-deploy-{stream}' + - name: '{module}-automate-docker-deploy-{stream}' current-parameters: false predefined-parameters: | GIT_BASE=$GIT_BASE @@ -175,7 +175,7 @@ name: generate-doc condition: SUCCESSFUL projects: - - name: 'testapi-automate-generate-doc-{stream}' + - name: '{module}-automate-generate-doc-{stream}' current-parameters: true kill-phase-on: FAILURE abort-all-job: true @@ -184,7 +184,7 @@ - 'email-publisher' - job-template: - name: 'testapi-automate-{phase}-{stream}' + name: '{module}-automate-{phase}-{stream}' properties: - throttle: @@ -196,10 +196,6 @@ - project-parameter: project: '{project}' branch: '{branch}' - - string: - name: DOCKER_TAG - default: "latest" - description: "Tag name for testapi docker image" wrappers: - ssh-agent-wrapper @@ -213,28 +209,16 @@ builders: - description-setter: description: "Built on $NODE_NAME" - - 'testapi-automate-{phase}-macro' + - '{module}-automate-{phase}-macro' ################################ # job builders ################################ - builder: - name: mongodb-backup - builders: - - shell: | - bash ./jjb/releng/testapi-backup-mongodb.sh - -- builder: - name: 'run-unit-tests' + name: 'docker-update' builders: - - shell: | - bash ./utils/test/testapi/run_test.sh - -- builder: - name: 'testapi-automate-docker-update-macro' - builders: - - shell: | - bash ./jjb/releng/testapi-docker-update.sh + - shell: + !include-raw: ./docker-update.sh - builder: name: 'testapi-automate-generate-doc-macro' @@ -254,11 +238,27 @@ - shell: | bash ./utils/test/testapi/htmlize/push-doc-artifact.sh +- builder: + name: 'reporting-automate-generate-doc-macro' + builders: + - shell: echo "To Be Done" + - builder: name: 'testapi-automate-docker-deploy-macro' builders: - shell: | - bash ./jjb/releng/testapi-docker-deploy.sh + bash ./jjb/releng/docker-deploy.sh 'sudo docker run -dti -p 8082:8000 -e mongodb_url=mongodb://172.17.0.1:27017 -e swagger_url=http://testresults.opnfv.org/test opnfv/testapi' "http://testresults.opnfv.org/test/swagger/APIs" +- builder: + name: 'reporting-automate-docker-deploy-macro' + builders: + - shell: | + bash ./jjb/releng/docker-deploy.sh 'sudo docker run -itd -p 8084:8000 -e SERVER_URL=http://testresults.opnfv.org/reporting2:8084 opnfv/reporting' "http://testresults.opnfv.org/reporting2/reporting/index.html" + +- builder: + name: mongodb-backup + builders: + - shell: | + bash ./jjb/releng/testapi-backup-mongodb.sh ################################ # job publishers @@ -268,6 +268,6 @@ name: 'email-publisher' publishers: - email: - recipients: rohitsakala@gmail.com feng.xiaowei@zte.com.cn + recipients: rohitsakala@gmail.com feng.xiaowei@zte.com.cn morgan.richomme@orange.com notify-every-unstable-build: false send-to-individuals: true diff --git a/jjb/releng/testapi-docker-deploy.sh b/jjb/releng/docker-deploy.sh similarity index 63% rename from jjb/releng/testapi-docker-deploy.sh rename to jjb/releng/docker-deploy.sh index 02c5e3a27..b3b930fc4 100644 --- a/jjb/releng/testapi-docker-deploy.sh +++ b/jjb/releng/docker-deploy.sh @@ -1,10 +1,30 @@ #!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one * +# or more contributor license agreements. See the NOTICE file * +# distributed with this work for additional information * +# regarding copyright ownership. The ASF licenses this file * +# to you under the Apache License, Version 2.0 (the * +# "License"); you may not use this file except in compliance * +# with the License. You may obtain a copy of the License at * +# * +# http://www.apache.org/licenses/LICENSE-2.0 * +# * +# Unless required by applicable law or agreed to in writing, * +# software distributed under the License is distributed on an * +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * +# KIND, either express or implied. See the License for the * +# specific language governing permissions and limitations * +# under the License. * + +# Assigning Variables +command=$1 +url=$2 function check() { # Verify hosted sleep 5 - cmd=`curl -s --head --request GET http://testresults.opnfv.org/test/swagger/APIs | grep '200 OK' > /dev/null` + cmd=`curl -s --head --request GET ${url} | grep '200 OK' > /dev/null` rc=$? echo $rc @@ -63,7 +83,7 @@ else fi echo "Running a container with the new image" -sudo docker run -dti -p "8082:8000" -e "mongodb_url=mongodb://172.17.0.1:27017" -e "swagger_url=http://testresults.opnfv.org/test" opnfv/testapi:latest +$command:latest if check; then echo "TestResults Hosted." @@ -71,7 +91,7 @@ else echo "TestResults Hosting Failed" if [[ $(sudo docker images | grep "opnfv/testapi" | grep "old" | awk '{print $3}') ]]; then echo "Running old Image" - sudo docker run -dti -p "8082:8000" -e "mongodb_url=mongodb://172.17.0.1:27017" -e "swagger_url=http://testresults.opnfv.org/test" opnfv/testapi:old + $command:old exit 1 fi fi diff --git a/jjb/releng/docker-update.sh b/jjb/releng/docker-update.sh new file mode 100644 index 000000000..559ac835c --- /dev/null +++ b/jjb/releng/docker-update.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one * +# or more contributor license agreements. See the NOTICE file * +# distributed with this work for additional information * +# regarding copyright ownership. The ASF licenses this file * +# to you under the Apache License, Version 2.0 (the * +# "License"); you may not use this file except in compliance * +# with the License. You may obtain a copy of the License at * +# * +# http://www.apache.org/licenses/LICENSE-2.0 * +# * +# Unless required by applicable law or agreed to in writing, * +# software distributed under the License is distributed on an * +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * +# KIND, either express or implied. See the License for the * +# specific language governing permissions and limitations * +# under the License. * + +set -o errexit +set -o nounset + +cd $WORKSPACE/utils/test/$MODULE_NAME/docker/ + +# Remove previous containers +docker ps -a | grep "opnfv/$MODULE_NAME" | awk '{ print $1 }' | xargs -r docker rm -f + +# Remove previous images +docker images | grep "opnfv/$MODULE_NAME" | awk '{ print $3 }' | xargs -r docker rmi -f + +# Start build +docker build --no-cache -t opnfv/$MODULE_NAME:$DOCKER_TAG . + +# Push Image +docker push opnfv/$MODULE_NAME:$DOCKER_TAG diff --git a/jjb/releng/testapi-docker-update.sh b/jjb/releng/testapi-docker-update.sh deleted file mode 100644 index 84f5c3217..000000000 --- a/jjb/releng/testapi-docker-update.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o nounset - -cd $WORKSPACE/utils/test/testapi/docker/ - -# Remove previous containers -docker ps -a | grep "opnfv/testapi" | awk '{ print $1 }' | xargs -r docker rm -f - -# Remove previous images -docker images | grep "opnfv/testapi" | awk '{ print $3 }' | xargs -r docker rmi -f - -# Start build -docker build --no-cache -t opnfv/testapi:$DOCKER_TAG . - -# Push Image -docker push opnfv/testapi:$DOCKER_TAG diff --git a/utils/push-test-logs.sh b/utils/push-test-logs.sh index f0c488a5a..5021b7832 100644 --- a/utils/push-test-logs.sh +++ b/utils/push-test-logs.sh @@ -30,7 +30,8 @@ node_list=(\ 'arm-pod1' 'arm-pod3' \ 'huawei-pod1' 'huawei-pod2' 'huawei-pod3' 'huawei-pod4' 'huawei-pod5' \ 'huawei-pod6' 'huawei-pod7' 'huawei-pod12' \ -'huawei-virtual1' 'huawei-virtual2' 'huawei-virtual3' 'huawei-virtual4') +'huawei-virtual1' 'huawei-virtual2' 'huawei-virtual3' 'huawei-virtual4'\ +'zte-virtual1') if [[ ! " ${node_list[@]} " =~ " ${testbed} " ]]; then diff --git a/utils/test/reporting/docker/requirements.pip b/utils/test/reporting/docker/requirements.pip index 6de856e35..aeee3ba96 100644 --- a/utils/test/reporting/docker/requirements.pip +++ b/utils/test/reporting/docker/requirements.pip @@ -12,3 +12,4 @@ PyYAML==3.11 simplejson==3.8.1 jinja2==2.8 tornado==4.4.2 +requests==2.12.5 diff --git a/utils/test/reporting/run_test.sh b/utils/test/reporting/run_test.sh new file mode 100755 index 000000000..8c674ce5f --- /dev/null +++ b/utils/test/reporting/run_test.sh @@ -0,0 +1,44 @@ +#!/bin/bash +set -o errexit +set -o pipefail + + +# Get script directory +SCRIPTDIR=`dirname $0` + +# Creating virtual environment +if [ ! -z $VIRTUAL_ENV ]; then + venv=$VIRTUAL_ENV +else + venv=$SCRIPTDIR/.venv + virtualenv $venv +fi + +source $venv/bin/activate + +export CONFIG_REPORTING_YAML=$SCRIPTDIR/reporting.yaml + +# *************** +# Run unit tests +# *************** +echo "Running unit tests..." + +# install python packages +easy_install -U setuptools +easy_install -U pip +pip install -r $SCRIPTDIR/docker/requirements.pip +pip install -e $SCRIPTDIR + +python $SCRIPTDIR/setup.py develop + +# unit tests +# TODO: remove cover-erase +# To be deleted when all functest packages will be listed +nosetests --with-xunit \ + --cover-package=$SCRIPTDIR/utils \ + --with-coverage \ + --cover-xml \ + $SCRIPTDIR/tests/unit +rc=$? + +deactivate diff --git a/utils/test/reporting/run_unit_tests.sh b/utils/test/reporting/run_unit_tests.sh deleted file mode 100755 index 6b0e3b2b1..000000000 --- a/utils/test/reporting/run_unit_tests.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -set -o errexit -set -o pipefail - -# ****************************** -# prepare the env for the tests -# ****************************** -# Either Workspace is set (CI) -if [ -z $WORKSPACE ] -then - WORKSPACE="." -fi - -export CONFIG_REPORTING_YAML=./reporting.yaml - -# *************** -# Run unit tests -# *************** -echo "Running unit tests..." - -# start vitual env -virtualenv $WORKSPACE/reporting_venv -source $WORKSPACE/reporting_venv/bin/activate - -# install python packages -easy_install -U setuptools -easy_install -U pip -pip install -r $WORKSPACE/docker/requirements.pip -pip install -e $WORKSPACE - -python $WORKSPACE/setup.py develop - -# unit tests -# TODO: remove cover-erase -# To be deleted when all functest packages will be listed -nosetests --with-xunit \ - --cover-package=utils \ - --with-coverage \ - --cover-xml \ - tests/unit -rc=$? - -deactivate