diff options
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/daily.sh | 8 | ||||
-rwxr-xr-x | ci/launch_docker_container.sh | 15 | ||||
-rwxr-xr-x | ci/merge.sh | 2 | ||||
-rwxr-xr-x | ci/remove_docker_container.sh | 2 | ||||
-rwxr-xr-x | ci/verify-build.sh | 84 |
5 files changed, 108 insertions, 3 deletions
diff --git a/ci/daily.sh b/ci/daily.sh index b984824..8af8562 100755 --- a/ci/daily.sh +++ b/ci/daily.sh @@ -1,4 +1,4 @@ -#!/bin/bash -x +#!/bin/bash -xe ############################################################################## # Copyright (c) 2015 EMC and others. # @@ -14,6 +14,12 @@ then WORKSPACE=`pwd` fi +docker-compose --version +if [ $? -ne 0 ] +then + echo "Docker compose is missing" + exit 1 +fi git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng $WORKSPACE/ci/job/releng diff --git a/ci/launch_docker_container.sh b/ci/launch_docker_container.sh index aac5b58..949bf9d 100755 --- a/ci/launch_docker_container.sh +++ b/ci/launch_docker_container.sh @@ -22,12 +22,27 @@ then sudo chown 33:33 ${ci}/job/carbon fi +if [ -z $ARCH ] +then + ARCH=x86_64 +fi + +export ARCH + docker-compose -f local-docker-compose.yaml build docker-compose -f local-docker-compose.yaml up -d echo "Waiting for StorPerf to become active" +ATTEMPTS=20 + while [ $(curl -s -o /dev/null -I -w "%{http_code}" -X GET http://127.0.0.1:5000/api/v1.0/configurations) != "200" ] do + ATTEMPTS=$((ATTEMPTS - 1)) + if [ ${ATTEMPTS} -le 1 ] + then + echo "Failed to get a start up of StorPerf Master" + exit 1 + fi sleep 1 done diff --git a/ci/merge.sh b/ci/merge.sh index 80ffdb6..bda24b6 100755 --- a/ci/merge.sh +++ b/ci/merge.sh @@ -9,4 +9,4 @@ ############################################################################## # Just run the verify again for now -`dirname $0`/verify.sh
\ No newline at end of file +`dirname $0`/verify.sh diff --git a/ci/remove_docker_container.sh b/ci/remove_docker_container.sh index 1764034..297b14f 100755 --- a/ci/remove_docker_container.sh +++ b/ci/remove_docker_container.sh @@ -19,7 +19,7 @@ export CARBON_DIR=${ci}/job/carbon/ docker-compose -f local-docker-compose.yaml down -for container_name in storperf storperf-master storperf-swaggerui storperf-httpfrontend storperf-reporting +for container_name in storperf storperf-master storperf-swaggerui storperf-httpfrontend storperf-reporting storperf-graphite do container=`docker ps -a -q -f name=$container_name` if [ ! -z $container ] diff --git a/ci/verify-build.sh b/ci/verify-build.sh new file mode 100755 index 0000000..9911566 --- /dev/null +++ b/ci/verify-build.sh @@ -0,0 +1,84 @@ +#!/bin/bash -xe +############################################################################## +# Copyright (c) 2017 Dell EMC and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +cd `dirname $0` +ci=`pwd` + +cd ${ci}/../docker + +export ENV_FILE=${ci}/job/admin.rc +export CARBON_DIR=${ci}/job/carbon/ + +${ci}/remove_docker_container.sh + +mkdir -p ${CARBON_DIR} +touch ${ENV_FILE} + +if [ -z $ARCH ] +then + ARCH=$(uname -m) +fi + +export ARCH=${ARCH} + +echo Using $ARCH architecture + +docker-compose -f local-docker-compose.yaml down +docker-compose -f local-docker-compose.yaml build +docker-compose -f local-docker-compose.yaml up -d + +function check_for_life() { + NAME=$1 + URI=$2 + + echo "Waiting for ${NAME} to become active" + ATTEMPTS=10 + + while [ $(curl -s -o /dev/null -I -w "%{http_code}" -X GET http://127.0.0.1:5000${URI}) != "200" ] + do + ATTEMPTS=$((ATTEMPTS - 1)) + if [ ${ATTEMPTS} -le 1 ] + then + echo "Failed to get a start up of ${NAME}" + return 1 + fi + sleep 2 + done +} + +FAILURES=0 + +check_for_life storperf-httpfrontend "/" +FAILURES=$((FAILURES + $?)) + +check_for_life storperf-master "/api/v1.0/configurations" +FAILURES=$((FAILURES + $?)) + +check_for_life storperf-reporting "/reporting/" +FAILURES=$((FAILURES + $?)) + +check_for_life storperf-swagger "/swagger/?url=http://127.0.0.1:5000/api/spec.json" +FAILURES=$((FAILURES + $?)) + +check_for_life storperf-graphite "/graphite/" +FAILURES=$((FAILURES + $?)) + + +for container in master graphite httpfrontend swaggerui reporting +do + echo "=====================================" + echo "Log for storperf-${container}" + docker logs storperf-${container} +done +echo "=====================================" + +docker-compose -f local-docker-compose.yaml down + +exit ${FAILURES} |