diff options
author | jose.lausuch <jose.lausuch@ericsson.com> | 2016-12-01 16:08:09 +0100 |
---|---|---|
committer | jose.lausuch <jose.lausuch@ericsson.com> | 2016-12-01 16:18:09 +0100 |
commit | b572ad0442c967dbd19b1de6b0bd0734f243d2b8 (patch) | |
tree | 034723017507b25dcbe5b4e0da392ac396777232 /jjb/functest | |
parent | 26f7afd1b5f9fae881fe5e5d26fce73f47cc7ca4 (diff) |
Functest jjob: add the option to provide the rc file as parameter
Change-Id: Icb5dd3f0f46eb4891609d1f0e4d868e84fe49a14
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'jjb/functest')
-rw-r--r-- | jjb/functest/functest-ci-jobs.yml | 6 | ||||
-rwxr-xr-x | jjb/functest/set-functest-env.sh | 50 |
2 files changed, 38 insertions, 18 deletions
diff --git a/jjb/functest/functest-ci-jobs.yml b/jjb/functest/functest-ci-jobs.yml index afeb1f92e..1cded61fc 100644 --- a/jjb/functest/functest-ci-jobs.yml +++ b/jjb/functest/functest-ci-jobs.yml @@ -280,7 +280,7 @@ - string: name: TESTCASE_OPTIONS default: '' - description: 'Addtional parameters specific to test case(s)' + description: 'Additional parameters specific to test case(s)' - parameter: name: functest-parameter parameters: @@ -300,6 +300,10 @@ name: CI_DEBUG default: 'false' description: "Show debug output information" + - string: + name: RC_FILE_PATH + default: '' + description: "Path to the OS credentials file if given" ######################## # trigger macros ######################## diff --git a/jjb/functest/set-functest-env.sh b/jjb/functest/set-functest-env.sh index bc30ffaf3..583ce8041 100755 --- a/jjb/functest/set-functest-env.sh +++ b/jjb/functest/set-functest-env.sh @@ -2,8 +2,23 @@ set -e [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null" -# labconfig is used only for joid -labconfig="" +# LAB_CONFIG is used only for joid + + +if [[ ${INSTALLER_TYPE} == 'joid' ]]; then + # If production lab then creds may be retrieved dynamically + # creds are on the jumphost, always in the same folder + rc_file_vol="-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 + +if [[ ${RC_FILE_PATH} != '' ]] && [[ -f ${RC_FILE_PATH} ]] ; then + # volume if credentials file path is given to Functest + rc_file_vol="-v $RC_FILE_PATH:/home/opnfv/functest/conf/openstack.creds" +fi + + if [[ ${INSTALLER_TYPE} == 'apex' ]]; then ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" if sudo virsh list | grep instack; then @@ -17,9 +32,9 @@ if [[ ${INSTALLER_TYPE} == 'apex' ]]; then 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" + sshkey_vol="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa" sudo scp $ssh_options root@${INSTALLER_IP}:/home/stack/stackrc ${HOME}/stackrc - stackrc="-v ${HOME}/stackrc:/home/opnfv/functest/conf/stackrc" + stackrc_vol="-v ${HOME}/stackrc:/home/opnfv/functest/conf/stackrc" 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 @@ -27,15 +42,10 @@ if [[ ${INSTALLER_TYPE} == 'apex' ]]; then 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 + + # 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 @@ -45,22 +55,28 @@ DEPLOY_TYPE=baremetal [[ $BUILD_TAG =~ "virtual" ]] && DEPLOY_TYPE=virt 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} -e DEPLOY_TYPE=${DEPLOY_TYPE}" + 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" +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}) +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}" + + +volumes="${results_vol} ${sshkey_vol} ${stackrc_vol} ${rc_file_vol}" + + 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} ${stackrc} ${TESTCASE_OPTIONS} \ +cmd="sudo docker run --privileged=true -id ${envs} ${volumes} \ + ${custom_params} ${TESTCASE_OPTIONS} \ opnfv/functest:${DOCKER_TAG} /bin/bash" echo "Functest: Running docker run command: ${cmd}" ${cmd} >${redirect} |