summaryrefslogtreecommitdiffstats
path: root/ci/verify-build.sh
blob: c98fea4f7a28ae40dcf0f40bef6e156319eca514 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/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}
cat << EOF > ${ENV_FILE}
OS_USERNAME=username
OS_PASSWORD=password
OS_AUTH_URL=http://localhost
OS_PROJECT_NAME=project
EOF

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

set +e

check_for_life storperf-httpfrontend "/"
FAILURES=$((FAILURES + $?))

check_for_life storperf-master "/api/v1.0/jobs"
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}