forked from SeldonIO/seldon-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci_build_and_push_images.sh
executable file
·127 lines (110 loc) · 2.75 KB
/
ci_build_and_push_images.sh
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
# FIRST WE START THE DOCKER DAEMON
service docker start
# the service can be started but the docker socket not ready, wait for ready
WAIT_N=0
while true; do
# docker ps -q should only work if the daemon is ready
docker ps -q > /dev/null 2>&1 && break
if [[ ${WAIT_N} -lt 5 ]]; then
WAIT_N=$((WAIT_N+1))
echo "[SETUP] Waiting for Docker to be ready, sleeping for ${WAIT_N} seconds ..."
sleep ${WAIT_N}
else
echo "[SETUP] Reached maximum attempts, not waiting any longer ..."
break
fi
done
#######################################
# AVOID EXIT ON ERROR FOR FOLLOWING CMDS
set +o errexit
function build_push_python {
(cd wrappers/s2i/python/build_scripts \
&& ./build_all_local.sh \
&& ./push_all.sh)
PYTHON_EXIT_VALUE=$?
}
function build_push_operator {
make \
-C operator \
docker-build \
docker-push \
docker-build-redhat
OPERATOR_EXIT_VALUE=$?
}
function build_push_executor {
make \
-C executor \
docker-build \
docker-push \
docker-build-redhat
EXECUTOR_EXIT_VALUE=$?
}
function build_push_engine {
make \
-C testing/scripts \
build_protos
make \
-C engine \
build_image \
push_to_registry \
docker-build-redhat
ENGINE_EXIT_VALUE=$?
}
function build_push_mock {
make \
-C examples/models/mean_classifier \
build_rest \
build_grpc \
push_rest \
push_grpc \
docker-build-redhat
MOCK_MODEL_EXIT_VALUE=$?
}
function build_push_alibi_detect {
make \
-C components/alibi-detect-server \
docker-build \
docker-push \
docker-build-redhat
ALIBI_DETECT_EXIT_VALUE=$?
}
function build_push_request_logger {
make \
-C components/seldon-request-logger \
build_image \
push_image \
docker-build-redhat
LOGGER_EXIT_VALUE=$?
}
build_push_python
build_push_operator
build_push_executor
build_push_engine
build_push_mock
build_push_alibi_detect
build_push_request_logger
#######################################
# EXIT STOPS COMMANDS FROM HERE ONWARDS
set -o errexit
# CLEANING DOCKER
docker ps -aq | xargs -r docker rm -f || true
service docker stop || true
# NOW THAT WE'VE CLEANED WE CAN EXIT ON TEST EXIT VALUE
echo "Python exit value: $PYTHON_EXIT_VALUE"
echo "Operator exit value: $OPERATOR_EXIT_VALUE"
echo "Engine exit value: $ENGINE_EXIT_VALUE"
echo "Executor exit value: $EXECUTOR_EXIT_VALUE"
echo "Mock model exit value: $MOCK_MODEL_EXIT_VALUE"
echo "Alibi Detect exit value: $ALIBI_DETECT_EXIT_VALUE"
echo "Request Logger exit value: $LOGGER_EXIT_VALUE"
exit $((${PYTHON_EXIT_VALUE} \
+ ${OPERATOR_EXIT_VALUE} \
+ ${ENGINE_EXIT_VALUE} \
+ ${EXECUTOR_EXIT_VALUE} \
+ ${MOCK_MODEL_EXIT_VALUE} \
+ ${ALIBI_DETECT_EXIT_VALUE} \
+ ${LOGGER_EXIT_VALUE}))