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
·209 lines (185 loc) · 4.52 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/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 \
&& ./build_redhat.sh \
&& ./push_redhat.sh)
PYTHON_EXIT_VALUE=$?
}
function build_push_operator {
make \
-C operator \
docker-build \
docker-push \
docker-build-redhat \
docker-push-redhat
OPERATOR_EXIT_VALUE=$?
}
function build_push_executor {
make \
-C executor \
docker-build \
docker-push \
docker-build-redhat \
docker-push-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 \
docker-push-redhat
ENGINE_EXIT_VALUE=$?
}
function build_push_mock {
make \
-C examples/models/mean_classifier \
build \
push
MOCK_MODEL_EXIT_VALUE=$?
}
function build_push_alibi_detect {
make \
-C components/alibi-detect-server \
docker-build \
docker-push
ALIBI_DETECT_EXIT_VALUE=$?
}
function build_push_request_logger {
make \
-C components/seldon-request-logger \
build_image \
push_image
LOGGER_EXIT_VALUE=$?
}
function build_push_sklearnserver {
make \
-C servers/sklearnserver \
build \
push
SKLEARN_EXIT_VALUE=$?
}
function build_push_mlflowserver {
make \
-C servers/mlflowserver \
build \
push
MLFLOW_EXIT_VALUE=$?
}
function build_push_xgboostserver {
make \
-C servers/xgboostserver \
build \
push
XGBOOST_EXIT_VALUE=$?
}
function build_push_tfproxy {
make \
-C servers/tfserving_proxy \
build \
push
TFPROXY_EXIT_VALUE=$?
}
function build_push_alibi_explainer {
make \
-C components/alibi-explain-server \
docker-build \
docker-push
EXPLAIN_EXIT_VALUE=$?
}
function build_push_storage_initializer {
make \
-C components/storage-initializer \
docker-build \
docker-push
STORAGE_INITIALIZER_EXIT_VALUE=$?
}
function build_push_rclone_storage_initializer {
make \
-C components/rclone-storage-initializer \
docker-build \
docker-push
RCLONE_STORAGE_INITIALIZER_EXIT_VALUE=$?
}
function build_push_mab {
make \
-C components/routers/epsilon-greedy \
build \
push
MAB_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
build_push_sklearnserver
build_push_mlflowserver
build_push_xgboostserver
build_push_tfproxy
build_push_alibi_explainer
build_push_storage_initializer
build_push_rclone_storage_initializer
build_push_mab
#######################################
# 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"
echo "Tensorflow Proxy exit value: $TFPROXY_EXIT_VALUE"
echo "Rclone Storage Initializer exit value: $RCLONE_STORAGE_INITIALIZER_EXIT_VALUE"
echo "MAB exit value: $MAB_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} \
+ ${SKLEARN_EXIT_VALUE} \
+ ${MLFLOW_EXIT_VALUE} \
+ ${XGBOOST_EXIT_VALUE} \
+ ${TFPROXY_EXIT_VALUE} \
+ ${STORAGE_INITIALIZER_EXIT_VALUE} \
+ ${RCLONE_STORAGE_INITIALIZER_EXIT_VALUE} \
+ ${MAB_EXIT_VALUE} \
+ ${EXPLAIN_EXIT_VALUE}))