a73e33c2cf00d18f9c583890f779a69c29997190
[releng.git] / jjb / qtip / helpers / validate-deploy.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2016 ZTE and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 set -e
10
11 envs="INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP}
12 -e NODE_NAME=${NODE_NAME} -e CI_DEBUG=${CI_DEBUG}"
13 dir_imgstore="${HOME}/imgstore"
14
15 echo "--------------------------------------------------------"
16 echo "POD: $NODE_NAME"
17 echo "INSTALLER: $INSTALLER_TYPE"
18 echo "Scenario: $DEPLOY_SCENARIO"
19 echo "--------------------------------------------------------"
20
21 echo "Qtip: Pulling docker image: opnfv/qtip:${DOCKER_TAG}"
22 docker pull opnfv/qtip:$DOCKER_TAG
23
24 cmd=" docker run -id -e $envs opnfv/qtip:${DOCKER_TAG} /bin/bash"
25 echo "Qtip: Running docker command: ${cmd}"
26 ${cmd}
27
28 container_id=$(docker ps | grep "opnfv/qtip:${DOCKER_TAG}" | awk '{print $1}' | head -1)
29 if [ $(docker ps | grep 'opnfv/qtip' | wc -l) == 0 ]; then
30     echo "The container opnfv/qtip with ID=${container_id} has not been properly started. Exiting..."
31     exit 1
32 else
33     echo "The container ID is: ${container_id}"
34     QTIP_REPO=/home/opnfv/repos/qtip
35 # TODO(zhihui_wu): use qtip cli to execute benchmark test in the future
36     docker exec -t ${container_id} bash -c "cd ${QTIP_REPO}/qtip/runner/ &&
37     python runner.py -d /home/opnfv/qtip/results/ -b all"
38
39 fi
40
41 echo "Qtip done!"