From 0e0e0d4cb71fb27b1789a2bef2d3c4ff313e67ff Mon Sep 17 00:00:00 2001 From: dongwenjuan Date: Tue, 31 Jul 2018 10:33:15 +0800 Subject: [PATCH] use tox instead of functest for doctor CI jobs Change-Id: Ifbde5ebd12a7e7a040a0a3b2a3eeed532a11da73 Signed-off-by: dongwenjuan --- jjb/doctor/doctor-env-presetup.sh | 45 ++++++++++++++++ jjb/doctor/doctor.yaml | 108 +++++--------------------------------- 2 files changed, 59 insertions(+), 94 deletions(-) create mode 100755 jjb/doctor/doctor-env-presetup.sh diff --git a/jjb/doctor/doctor-env-presetup.sh b/jjb/doctor/doctor-env-presetup.sh new file mode 100755 index 000000000..b80b711a3 --- /dev/null +++ b/jjb/doctor/doctor-env-presetup.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +set -o errexit +set -o pipefail + +# Fetch INSTALLER_IP for APEX deployments +if [[ ${INSTALLER_TYPE} == 'apex' ]]; then + + echo "Gathering IP information for Apex installer VM" + ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" + if sudo virsh list | grep undercloud; then + echo "Installer VM detected" + undercloud_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]+") + export INSTALLER_IP=$(/usr/sbin/arp -e | grep ${undercloud_mac} | awk {'print $1'}) + echo "Installer ip is ${INSTALLER_IP}" + else + echo "No available installer VM exists and no credentials provided...exiting" + exit 1 + fi + +elif [[ ${INSTALLER_TYPE} == 'daisy' ]]; then + echo "Gathering IP information for Daisy installer VM" + if sudo virsh list | grep daisy; then + echo "Installer VM detected" + + bridge_name=$(sudo virsh domiflist daisy | grep vnet | awk '{print $3}') + echo "Bridge is $bridge_name" + + installer_mac=$(sudo virsh domiflist daisy | grep vnet | \ + grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+") + export INSTALLER_IP=$(/usr/sbin/arp -e -i $bridge_name | grep ${installer_mac} | head -n 1 | awk {'print $1'}) + + echo "Installer ip is ${INSTALLER_IP}" + else + echo "No available installer VM exists...exiting" + exit 1 + fi + +elif [[ ${INSTALLER_TYPE} == 'fuel' ]]; then + if [[ ! "${BRANCH}" =~ "danube" ]]; then + echo "Map mcp ssh_key" + export sshkey_vol="-v ${SSH_KEY:-/var/lib/opnfv/mcp.rsa}:/root/.ssh/id_rsa" + fi +fi + diff --git a/jjb/doctor/doctor.yaml b/jjb/doctor/doctor.yaml index 0d7b781a7..566625edd 100644 --- a/jjb/doctor/doctor.yaml +++ b/jjb/doctor/doctor.yaml @@ -8,23 +8,16 @@ - master: branch: '{stream}' gs-pathname: '' - docker-tag: 'latest' disabled: false - fraser: &fraser branch: 'stable/{stream}' gs-pathname: '/{stream}' - docker-tag: 'stable' disabled: false - # feature projects' tests are not triggered by functest - # doctor verify Pods need to deploy with these scenario installer: - - 'apex': - scenario: 'os-nosdn-kvm-ha' - - 'fuel': - scenario: 'os-nosdn-ovs-ha' - - 'daisy': - scenario: 'os-nosdn-ovs_dpdk-noha' + - 'apex' + - 'fuel' + - 'daisy' arch: - 'x86_64' @@ -43,8 +36,6 @@ # these would beenabled again once the PoDs are ready - installer: 'fuel' arch: 'x86_64' - - installer: 'daisy' - arch: 'x86_64' jobs: - 'doctor-verify-{inspector}-{stream}' @@ -127,16 +118,12 @@ branch: '{branch}' - '{installer}-defaults' - 'doctor-slave-parameter' - - 'doctor-parameter': - docker-tag: '{docker-tag}' - scenario: '{scenario}' - - 'doctor-functest-parameter': - gs-pathname: '{gs-pathname}' - inspector: '{inspector}' scm: - git-scm-gerrit builders: - - 'doctor-verify-installer-inspector-builders-macro' + - doctor-verify-installer-inspector-builders-macro: + installer: '{installer}' + inspector: '{inspector}' publishers: - 'doctor-verify-publishers-macro' @@ -144,61 +131,7 @@ # ------------------------------- # parameter macros # ------------------------------- -- parameter: - name: 'doctor-parameter' - parameters: - - string: - name: OS_CREDS - default: /home/jenkins/openstack.creds - description: 'OpenStack credentials' - - string: - name: DOCKER_TAG - default: '{docker-tag}' - description: 'Tag to pull docker image' - - string: - name: CLEAN_DOCKER_IMAGES - default: 'false' - description: 'Remove downloaded docker images (opnfv/functest:*)' - - string: - name: DEPLOY_SCENARIO - default: '{scenario}' - description: 'Scenario to deploy and test' -- parameter: - name: 'doctor-functest-parameter' - parameters: - # functest-suite-parameter - - string: - name: FUNCTEST_MODE - default: 'testcase' - - string: - name: FUNCTEST_SUITE_NAME - default: 'doctor-notification' - - string: - name: TESTCASE_OPTIONS - # yamllint disable rule:line-length - default: '-e INSPECTOR_TYPE={inspector} -v $WORKSPACE:/home/opnfv/repos/doctor' - # yamllint enable rule:line-length - description: 'Addtional parameters specific to test case(s)' - # functest-parameter - - string: - name: GS_PATHNAME - default: '{gs-pathname}' - # yamllint disable rule:line-length - description: "Version directory where the opnfv documents will be stored in gs repository" - # yamllint enable rule:line-length - - string: - name: FUNCTEST_REPO_DIR - default: "/home/opnfv/repos/functest" - description: "Directory where the Functest repository is cloned" - - string: - name: PUSH_RESULTS_TO_DB - default: "true" - description: "Push the results of all the tests to the resultDB" - - string: - name: CI_DEBUG - default: 'true' - description: "Show debug output information" # ------------------------------- # builder macros # ------------------------------- @@ -207,26 +140,15 @@ name: 'doctor-verify-installer-inspector-builders-macro' builders: - 'clean-workspace-log' - # yamllint disable rule:line-length - shell: | - # NOTE: Create symbolic link, so that we can archive file outside - # of $WORKSPACE . - # NOTE: We are printing all logs under 'tests/' during test run, - # so this symbolic link should not be in 'tests/'. Otherwise, - # we'll have the same log twice in jenkins console log. - ln -sfn $HOME/opnfv/functest/results/{stream} functest_results - # NOTE: Get functest script in $WORKSPACE. This functest script is - # needed to perform VM image download in set-functest-env.sh - # from E release cycle. - mkdir -p functest/ci - wget https://git.opnfv.org/functest/plain/functest/ci/download_images.sh -O functest/ci/download_images.sh - - 'functest-suite-builder' - - shell: | - functest_log="$HOME/opnfv/functest/results/{stream}/$FUNCTEST_SUITE_NAME.log" - # NOTE: checking the test result, as the previous job could return - # 0 regardless the result of doctor test scenario. - grep -e 'doctor test successfully' $functest_log || exit 1 - # yamllint enable rule:line-length + export INSTALLER_TYPE={installer} + export INSPECTOR_TYPE={inspector} + !include-raw: + - ./doctor-env-presetup.sh + - ../../utils/fetch_os_creds.sh + source $HOME/opnfv-openrc.sh + source $HOME/os_cacert + tox -e py35 # ------------------------------- # publisher macros @@ -236,8 +158,6 @@ publishers: - archive: artifacts: 'doctor_tests/*.log' - - archive: - artifacts: 'functest_results/$FUNCTEST_SUITE_NAME.log' - email-jenkins-admins-on-failure -- 2.16.6