@@ -7,7 +7,7 @@ function restart_apici ()
7
7
8
8
for APICI in ${APICIS[@]}
9
9
do
10
- sudo systemctl stop ${APICI} .service
10
+ sudo systemctl stop ${APICI} .service || true
11
11
sudo install --owner=root --group=root --mode=0644 ./libvirt/tunnel/${APICI} .service /usr/lib/systemd/system/
12
12
done
13
13
sudo systemctl daemon-reload
@@ -25,6 +25,17 @@ function restart_haproxy ()
25
25
sudo systemctl status haproxy.service
26
26
}
27
27
28
+ function my_sha ()
29
+ {
30
+ local F=${1}
31
+
32
+ SUM=$( sudo sha1sum ${F} | cut -f1 -d' ' )
33
+ RC=${PIPESTATUS[0]}
34
+ echo ${SUM}
35
+
36
+ return ${RC}
37
+ }
38
+
28
39
function shas_unmodified ()
29
40
{
30
41
local -n ARRAY1=$1
52
63
echo " ERROR: NAMESPACE environment variable must have a value!"
53
64
exit 1
54
65
fi
66
+ case ${NAMESPACE} in
67
+ " bastion-ppc64le-libvirt" |" bastion-z" )
68
+ ;;
69
+ " *" )
70
+ echo " ERROR: Invalid NAMESPACE value of ${NAMESPACE} "
71
+ exit 1
72
+ ;;
73
+ esac
55
74
if [[ ! -v LOGIN_TOKEN_B01 ]]
56
75
then
57
76
echo " ERROR: LOGIN_TOKEN_B01 environment variable must be set!"
95
114
fi
96
115
97
116
SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd ) "
117
+ # SCRIPT_DIR="/home/ocp/ocp-remote-ci" # For hacking
98
118
99
119
if [[ ! -d " ${SCRIPT_DIR} " ]]
100
120
then
@@ -114,14 +134,14 @@ function get_token ()
114
134
STATUS=$( oc get pods --namespace=${NAMESPACE} --selector=component=sshd -o=json | jq --raw-output ' .items[].status.containerStatuses[].ready' )
115
135
if [ " ${STATUS} " == " false" ]
116
136
then
117
- echo " "
137
+ echo " Error: sshd pod is not ready "
118
138
return 1
119
139
fi
120
140
121
141
TOKEN=$( oc sa get-token port-forwarder --namespace=${NAMESPACE} )
122
142
if [ -z " ${TOKEN} " ]
123
143
then
124
- echo " "
144
+ echo " Error: oc sa get-token port-forwarder returned an empty token?! "
125
145
return 1
126
146
fi
127
147
@@ -149,27 +169,50 @@ declare -a LIBVIRT_FILES_OLD_SHA
149
169
LIBVIRT_FILES=(
150
170
" libvirt/tunnel/apici_build01.service"
151
171
" libvirt/tunnel/apici_build02.service"
172
+ " libvirt/tunnel/tunnel.sh"
173
+ )
174
+
175
+ case ${NAMESPACE} in
176
+ " bastion-ppc64le-libvirt" )
177
+ LIBVIRT_FILES+=(
152
178
" libvirt/tunnel/profile_C155F2U31.yaml"
153
179
" libvirt/tunnel/profile_C155F2U33.yaml"
154
180
" libvirt/tunnel/profile_C155F2U35.yaml"
155
- " libvirt/tunnel/tunnel.sh"
156
- )
181
+ )
182
+ ;;
183
+ " bastion-z" )
184
+ LIBVIRT_FILES+=(
185
+ " libvirt/tunnel/profile_lnxocp01.yaml"
186
+ " libvirt/tunnel/profile_lnxocp01.yaml"
187
+ )
188
+ ;;
189
+ esac
157
190
158
191
for FILE in ${LIBVIRT_FILES[@]}
159
192
do
160
- SUM=$( sha1sum ${FILE} | cut -f1 -d' ' )
193
+ SUM=$( sudo sha1sum ${FILE} | cut -f1 -d' ' )
161
194
LIBVIRT_FILES_OLD_SHA+=( ${SUM} )
162
195
done
163
196
164
- OLD_INSTALL_CI_SHA1SUM=$( sudo sha1sum /home/ocp/ocp-remote-ci/install-ci.sh | awk ' {print $1}' )
197
+ OLD_INSTALL_CI_SHA1SUM=$( my_sha ${SCRIPT_DIR} /install-ci.sh)
198
+ RC=$?
199
+ if [ ${RC} -gt 0 ]
200
+ then
201
+ exit 1
202
+ fi
165
203
166
204
git reset --hard HEAD
167
205
git clean -fxd .
168
206
git checkout master
169
207
git fetch
170
208
git checkout -m origin/master install-ci.sh
171
209
172
- NEW_INSTALL_CI_SHA1SUM=$( sudo sha1sum /home/ocp/ocp-remote-ci/install-ci.sh | awk ' {print $1}' )
210
+ NEW_INSTALL_CI_SHA1SUM=$( my_sha ${SCRIPT_DIR} /install-ci.sh)
211
+ RC=$?
212
+ if [ ${RC} -gt 0 ]
213
+ then
214
+ exit 1
215
+ fi
173
216
174
217
if [[ " ${OLD_INSTALL_CI_SHA1SUM} " != " ${NEW_INSTALL_CI_SHA1SUM} " ]]
175
218
then
0 commit comments