From 3638eaa6af53d32bda130d843bc17123ec9ef3bb Mon Sep 17 00:00:00 2001 From: Fatih Degirmenci Date: Sun, 22 May 2016 22:09:10 +0200 Subject: functest: Take builders out of jjb Change-Id: I546b1b323db2d1839335a34e8293b27f368b0626 Signed-off-by: Fatih Degirmenci --- jjb/functest/functest-ci-jobs.yml | 129 +++----------------------------------- 1 file changed, 9 insertions(+), 120 deletions(-) (limited to 'jjb/functest/functest-ci-jobs.yml') diff --git a/jjb/functest/functest-ci-jobs.yml b/jjb/functest/functest-ci-jobs.yml index ce7be1fa9..0af55977f 100644 --- a/jjb/functest/functest-ci-jobs.yml +++ b/jjb/functest/functest-ci-jobs.yml @@ -232,140 +232,29 @@ - builder: name: functest-suite builders: - - shell: | - #!/bin/bash - 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 - + - shell: + !include-raw-escape: ./functest-suite.sh - builder: name: functest-daily builders: - - shell: | - #!/bin/bash - set +e - 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 + - shell: + !include-raw-escape: ./functest-daily.sh - builder: name: set-functest-env builders: - - shell: | - #!/bin/bash - set -e - [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null" - # labconfig is used only for joid - labconfig="" - if [[ ${INSTALLER_TYPE} == 'apex' ]]; then - 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" - 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 - labconfig="-v $LAB_CONFIG/admin-openrc:/home/opnfv/functest/conf/openstack.creds" - # If dev lab, credentials may not be the default ones, just provide a path to put them into docker - # replace the default one by the customized one provided by jenkins config - fi - echo "Functest: Start Docker and prepare environment" - envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \ - -e NODE_NAME=${NODE_NAME} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO} \ - -e BUILD_TAG=${BUILD_TAG} -e CI_DEBUG=${CI_DEBUG}" - branch=${GIT_BRANCH##*/} - dir_result="${HOME}/opnfv/functest/results/${branch}" - 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 >/dev/null - - 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} - sleep 5 - container_id=$(docker ps | grep "opnfv/functest:${DOCKER_TAG}" | awk '{print $1}' | head -1) - echo "Container ID=${container_id}" - if [ -z ${container_id} ]; then - echo "Cannot find opnfv/functest container ID ${container_id}. Please check if it is existing." - docker ps -a - exit 1 - fi - echo "Starting the container: docker start ${container_id}" - docker start ${container_id} - sleep 5 - 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 - 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} + - shell: + !include-raw-escape: ./set-functest-env.sh - builder: name: functest-store-results builders: - shell: - !include-raw: ../../utils/push-test-logs.sh + !include-raw-escape: ../../utils/push-test-logs.sh - builder: name: functest-cleanup builders: - - shell: | - #!/bin/bash - [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null" - - echo "Cleaning up docker containers/images..." - # Remove previous running containers if exist - if [[ ! -z $(docker ps -a | grep opnfv/functest) ]]; then - echo "Removing existing opnfv/functest containers..." - docker ps -a | grep opnfv/functest | awk '{print $1}' | xargs docker rm -f >${redirect} - fi - - # 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 >${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 >/dev/null - done - fi + - shell: + !include-raw-escape: ./functest-cleanup.sh -- cgit 1.2.3-korg