Skip to content

Commit 658d847

Browse files
committed
Various fixes
1 parent 457e052 commit 658d847

File tree

1 file changed

+51
-8
lines changed

1 file changed

+51
-8
lines changed

install-ci.sh

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function restart_apici ()
77

88
for APICI in ${APICIS[@]}
99
do
10-
sudo systemctl stop ${APICI}.service
10+
sudo systemctl stop ${APICI}.service || true
1111
sudo install --owner=root --group=root --mode=0644 ./libvirt/tunnel/${APICI}.service /usr/lib/systemd/system/
1212
done
1313
sudo systemctl daemon-reload
@@ -25,6 +25,17 @@ function restart_haproxy ()
2525
sudo systemctl status haproxy.service
2626
}
2727

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+
2839
function shas_unmodified ()
2940
{
3041
local -n ARRAY1=$1
@@ -52,6 +63,14 @@ then
5263
echo "ERROR: NAMESPACE environment variable must have a value!"
5364
exit 1
5465
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
5574
if [[ ! -v LOGIN_TOKEN_B01 ]]
5675
then
5776
echo "ERROR: LOGIN_TOKEN_B01 environment variable must be set!"
@@ -95,6 +114,7 @@ then
95114
fi
96115

97116
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
117+
#SCRIPT_DIR="/home/ocp/ocp-remote-ci" # For hacking
98118

99119
if [[ ! -d "${SCRIPT_DIR}" ]]
100120
then
@@ -114,14 +134,14 @@ function get_token ()
114134
STATUS=$(oc get pods --namespace=${NAMESPACE} --selector=component=sshd -o=json | jq --raw-output '.items[].status.containerStatuses[].ready')
115135
if [ "${STATUS}" == "false" ]
116136
then
117-
echo ""
137+
echo "Error: sshd pod is not ready"
118138
return 1
119139
fi
120140

121141
TOKEN=$(oc sa get-token port-forwarder --namespace=${NAMESPACE})
122142
if [ -z "${TOKEN}" ]
123143
then
124-
echo ""
144+
echo "Error: oc sa get-token port-forwarder returned an empty token?!"
125145
return 1
126146
fi
127147

@@ -149,27 +169,50 @@ declare -a LIBVIRT_FILES_OLD_SHA
149169
LIBVIRT_FILES=(
150170
"libvirt/tunnel/apici_build01.service"
151171
"libvirt/tunnel/apici_build02.service"
172+
"libvirt/tunnel/tunnel.sh"
173+
)
174+
175+
case ${NAMESPACE} in
176+
"bastion-ppc64le-libvirt")
177+
LIBVIRT_FILES+=(
152178
"libvirt/tunnel/profile_C155F2U31.yaml"
153179
"libvirt/tunnel/profile_C155F2U33.yaml"
154180
"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
157190

158191
for FILE in ${LIBVIRT_FILES[@]}
159192
do
160-
SUM=$(sha1sum ${FILE} | cut -f1 -d' ')
193+
SUM=$(sudo sha1sum ${FILE} | cut -f1 -d' ')
161194
LIBVIRT_FILES_OLD_SHA+=( ${SUM} )
162195
done
163196

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
165203

166204
git reset --hard HEAD
167205
git clean -fxd .
168206
git checkout master
169207
git fetch
170208
git checkout -m origin/master install-ci.sh
171209

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
173216

174217
if [[ "${OLD_INSTALL_CI_SHA1SUM}" != "${NEW_INSTALL_CI_SHA1SUM}" ]]
175218
then

0 commit comments

Comments
 (0)