summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Lausuch <jalausuch@suse.com>2017-11-16 08:35:04 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-11-16 08:35:05 +0000
commit4245897311f394b2d4805337d85f28c0988320ae (patch)
treeaefb416217e134cacfb81c59605eae0e80959b21
parentb7746852079be9b08fb693b3c2ebb1b5879f5303 (diff)
parent3b97f089806ef7f81aec2c56e740aa1f1e418649 (diff)
Merge "[Functest] Switch ARM jobs to Alpine containers"
-rwxr-xr-xjjb/functest/functest-alpine.sh2
-rw-r--r--jjb/functest/functest-daily-jobs.yml9
-rwxr-xr-xjjb/functest/functest-loop.sh14
-rw-r--r--jjb/functest/functest-weekly-jobs.yml8
-rwxr-xr-xjjb/functest/set-functest-env.sh111
5 files changed, 5 insertions, 139 deletions
diff --git a/jjb/functest/functest-alpine.sh b/jjb/functest/functest-alpine.sh
index bd2bdf4a8..3c1ac28bb 100755
--- a/jjb/functest/functest-alpine.sh
+++ b/jjb/functest/functest-alpine.sh
@@ -71,7 +71,7 @@ FUNCTEST_DIR=/home/opnfv/functest
DEPLOY_TYPE=baremetal
[[ $BUILD_TAG =~ "virtual" ]] && DEPLOY_TYPE=virt
HOST_ARCH=$(uname -m)
-DOCKER_TAG=${DOCKER_TAG:-latest}
+DOCKER_TAG=`[[ ${BRANCH##*/} == "master" ]] && echo "latest" || echo ${BRANCH##*/}`
# Prepare OpenStack credentials volume
rc_file=${HOME}/opnfv-openrc.sh
diff --git a/jjb/functest/functest-daily-jobs.yml b/jjb/functest/functest-daily-jobs.yml
index 2fc70b916..2d5d397ae 100644
--- a/jjb/functest/functest-daily-jobs.yml
+++ b/jjb/functest/functest-daily-jobs.yml
@@ -14,12 +14,10 @@
stream: master
branch: '{stream}'
gs-pathname: ''
- docker-tag: 'latest'
euphrates: &euphrates
stream: euphrates
branch: 'stable/{stream}'
gs-pathname: '/{stream}'
- docker-tag: 'stable'
# -------------------------------
# POD, INSTALLER, AND BRANCH MAPPING
# -------------------------------
@@ -234,10 +232,6 @@
name: DEPLOY_SCENARIO
default: 'os-odl_l2-nofeature-ha'
- 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*:*)'
@@ -399,8 +393,7 @@
!include-raw:
- ./functest-env-presetup.sh
- ../../utils/fetch_os_creds.sh
- - ./set-functest-env.sh
- - ./functest-loop.sh
+ - ./functest-alpine.sh
# yamllint enable rule:indentation
- builder:
diff --git a/jjb/functest/functest-loop.sh b/jjb/functest/functest-loop.sh
deleted file mode 100755
index a590d9f95..000000000
--- a/jjb/functest/functest-loop.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-set +e
-
-[[ "$PUSH_RESULTS_TO_DB" == "true" ]] && flags+="-r"
-cmd="run_tests -t all ${flags}"
-
-container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1)
-docker exec $container_id $cmd
-
-ret_value=$?
-ret_val_file="${HOME}/opnfv/functest/results/${BRANCH##*/}/return_value"
-echo ${ret_value}>${ret_val_file}
-
-exit 0
diff --git a/jjb/functest/functest-weekly-jobs.yml b/jjb/functest/functest-weekly-jobs.yml
index 6826e4151..5d572aacc 100644
--- a/jjb/functest/functest-weekly-jobs.yml
+++ b/jjb/functest/functest-weekly-jobs.yml
@@ -118,13 +118,11 @@
# yamllint disable rule:indentation
- shell:
!include-raw:
- - ./functest-env-presetup.sh
- - ../../utils/fetch_os_creds.sh
- - ./set-functest-env.sh
+ - ./functest-env-presetup.sh
+ - ../../utils/fetch_os_creds.sh
+ - ./functest-alpine.sh
# yamllint enable rule:indentation
- shell:
- !include-raw: ./functest-loop.sh
- - shell:
!include-raw: ../../utils/push-test-logs.sh
- shell:
!include-raw: ./functest-exit.sh
diff --git a/jjb/functest/set-functest-env.sh b/jjb/functest/set-functest-env.sh
deleted file mode 100755
index b116a8528..000000000
--- a/jjb/functest/set-functest-env.sh
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/bin/bash
-
-set -e
-set +u
-set +o pipefail
-
-[[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
-
-DEPLOY_TYPE=baremetal
-[[ $BUILD_TAG =~ "virtual" ]] && DEPLOY_TYPE=virt
-HOST_ARCH=$(uname -m)
-
-# Prepare OpenStack credentials volume
-rc_file_vol="-v ${HOME}/opnfv-openrc.sh:/home/opnfv/functest/conf/openstack.creds"
-
-if [[ ${INSTALLER_TYPE} == 'joid' ]]; then
- rc_file_vol="-v $LAB_CONFIG/admin-openrc:/home/opnfv/functest/conf/openstack.creds"
-elif [[ ${INSTALLER_TYPE} == 'compass' && ${BRANCH} == 'master' ]]; then
- cacert_file_vol="-v ${HOME}/os_cacert:/home/opnfv/functest/conf/os_cacert"
- echo "export OS_CACERT=/home/opnfv/functest/conf/os_cacert" >> ${HOME}/opnfv-openrc.sh
-elif [[ ${INSTALLER_TYPE} == 'fuel' && ${DEPLOY_TYPE} == 'baremetal' ]]; then
- cacert_file_vol="-v ${HOME}/os_cacert:/etc/ssl/certs/mcp_os_cacert"
-fi
-
-
-# Set iptables rule to allow forwarding return traffic for container
-if ! sudo iptables -C FORWARD -j RETURN 2> ${redirect} || ! sudo iptables -L FORWARD | awk 'NR==3' | grep RETURN 2> ${redirect}; then
- sudo iptables -I FORWARD -j RETURN
-fi
-
-echo "Functest: Start Docker and prepare environment"
-
-if [ "$BRANCH" != 'stable/danube' ]; then
- echo "Functest: Download images that will be used by test cases"
- images_dir="${HOME}/opnfv/functest/images"
- chmod +x ${WORKSPACE}/functest/ci/download_images.sh
- ${WORKSPACE}/functest/ci/download_images.sh ${images_dir} > ${redirect}
- images_vol="-v ${images_dir}:/home/opnfv/functest/images"
- echo "Functest: Images successfully downloaded"
-fi
-
-dir_result="${HOME}/opnfv/functest/results/${BRANCH##*/}"
-mkdir -p ${dir_result}
-sudo rm -rf ${dir_result}/*
-results_vol="-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: custom parameters successfully retrieved: ${custom_params}"
-
-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} -e DEPLOY_TYPE=${DEPLOY_TYPE}"
-
-ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
-
-if [ "${INSTALLER_TYPE}" == 'fuel' ] && [ "$BRANCH" != 'stable/danube' ]; then
- COMPUTE_ARCH=$(ssh -l ubuntu ${INSTALLER_IP} -i ${SSH_KEY} ${ssh_options} \
- "sudo salt 'cmp*' grains.get cpuarch --out yaml | awk '{print \$2; exit}'")
- envs="${envs} -e POD_ARCH=${COMPUTE_ARCH}"
-fi
-
-if [[ ${INSTALLER_TYPE} == 'compass' && ${DEPLOY_SCENARIO} == *'os-nosdn-openo-ha'* ]]; then
- openo_msb_port=${openo_msb_port:-80}
- openo_msb_endpoint="$(sshpass -p'root' ssh 2>/dev/null $ssh_options root@${installer_ip} \
- 'mysql -ucompass -pcompass -Dcompass -e "select package_config from cluster;" \
- | sed s/,/\\n/g | grep openo_ip | cut -d \" -f 4'):$openo_msb_port"
-
- envs=${env}" -e OPENO_MSB_ENDPOINT=${openo_msb_endpoint}"
-fi
-
-if [ "$BRANCH" != 'stable/danube' ]; then
- volumes="${images_vol} ${results_vol} ${sshkey_vol} ${stackrc_vol} ${rc_file_vol} ${cacert_file_vol}"
-else
- volumes="${results_vol} ${sshkey_vol} ${stackrc_vol} ${rc_file_vol}"
-fi
-
-echo "Functest: volumes defined"
-
-FUNCTEST_IMAGE="opnfv/functest"
-if [ "$HOST_ARCH" = "aarch64" ]; then
- FUNCTEST_IMAGE="${FUNCTEST_IMAGE}_${HOST_ARCH}"
-fi
-
-echo "Functest: Pulling Functest Docker image ${FUNCTEST_IMAGE}:${DOCKER_TAG}"
-docker pull ${FUNCTEST_IMAGE}:$DOCKER_TAG >/dev/null
-
-cmd="sudo docker run --privileged=true -id ${envs} ${volumes} \
- ${custom_params} ${TESTCASE_OPTIONS} \
- ${FUNCTEST_IMAGE}:${DOCKER_TAG} /bin/bash"
-echo "Functest: Running docker run command: ${cmd}"
-${cmd} >${redirect}
-sleep 5
-container_id=$(docker ps | grep "${FUNCTEST_IMAGE}:${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 "${FUNCTEST_IMAGE}:${DOCKER_TAG}" | wc -l) == 0 ]; then
- echo "The container ${FUNCTEST_IMAGE} with ID=${container_id} has not been properly started. Exiting..."
- exit 1
-fi
-
-cmd="prepare_env start"
-echo "Executing command inside the docker: ${cmd}"
-docker exec ${container_id} ${cmd}