bugfix: copy hosts file
[bottlenecks.git] / ci / docker_run.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 set -ex
12
13 docker build -t opnfv/bottlenecks ${BOTTLENECKS_TOP_DIR}/ci/docker/
14
15 if [ x"${GERRIT_REFSPEC_DEBUG}" != x ]; then
16     opts="--privileged=true"
17     BOTTLENECKS_BRANCH=${GERRIT_REFSPEC_DEBUG}
18 else
19     opts="--privileged=true --rm"
20     BOTTLENECKS_BRANCH=${GIT_BRANCH##origin/}
21 fi
22
23 envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} -e NODE_NAME=${NODE_NAME} -e EXTERNAL_NET=${EXTERNAL_NETWORK} -e BOTTLENECKS_BRANCH=${BOTTLENECKS_BRANCH} -e GERRIT_REFSPEC_DEBUG=${GERRIT_REFSPEC_DEBUG} -e BOTTLENECKS_DB_TARGET=${BOTTLENECKS_DB_TARGET} -e PACKAGE_URL=${PACKAGE_URL}"
24 volumes="-v ${BOTTLENECKS_TOP_DIR}:${BOTTLENECKS_TOP_DIR}"
25 run_testsuite=${BOTTLENECKS_TOP_DIR}/run_tests.sh -s ${SUITE_NAME}
26
27 echo ${envs} ${ops} ${volumes}
28
29 # Run docker
30 cmd="sudo docker run ${opts} ${envs} ${volumes} opnfv/bottlenecks ${run_testsuite}"
31 echo "Bottlenecks: Running docker cmd: ${cmd}"
32 ${cmd}
33
34 echo "Bottlenecks: done!"
35
36 set +ex