This repository has been archived by the owner on Apr 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
travis-check-pods.sh
74 lines (68 loc) · 2.05 KB
/
travis-check-pods.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
#!/bin/bash
oc login -u system:admin
oc project default
while true; do
V=$(oc get dc docker-registry --template='{{index .status "latestVersion"}}')
P=$(oc get pod docker-registry-$V-deploy --template='{{index .status "phase"}}')
if [ "$?" -eq 0 ]; then
echo phase is $P for docker-registry deploy $V
if [ "$P" == "Failed" ]; then
echo "registry deploy failed, try again"
oc get pods
oc rollout retry dc/docker-registry
sleep 10
continue
fi
fi
REG=$(oc get pod -l deploymentconfig=docker-registry --template='{{index .items 0 "status" "phase"}}')
if [ "$?" -eq 0 ]; then
break
fi
oc get pods
echo "Waiting for registry pod"
sleep 10
done
while true; do
REG=$(oc get pod -l deploymentconfig=docker-registry --template='{{index .items 0 "status" "phase"}}')
if [ "$?" -ne 0 -o "$REG" == "Error" ]; then
echo "Registy pod is in error state..."
exit 1
fi
if [ "$REG" == "Running" ]; then
break
fi
sleep 5
done
while true; do
V=$(oc get dc router --template='{{index .status "latestVersion"}}')
P=$(oc get pod router-$V-deploy --template='{{index .status "phase"}}')
if [ "$?" -eq 0 ]; then
echo phase is $P for router deploy $V
if [ "$P" == "Failed" ]; then
echo "router deploy failed, try again"
oc get pods
oc rollout retry dc/router
sleep 10
continue
fi
fi
REG=$(oc get pod -l deploymentconfig=router --template='{{index .items 0 "status" "phase"}}')
if [ "$?" -eq 0 ]; then
break
fi
oc get pods
echo "Waiting for router pod"
sleep 10
done
while true; do
REG=$(oc get pod -l deploymentconfig=router --template='{{index .items 0 "status" "phase"}}')
if [ "$?" -ne 0 -o "$REG" == "Error" ]; then
echo "Router pod is in error state..."
exit 1
fi
if [ "$REG" == "Running" ]; then
break
fi
sleep 5
done
echo "Registry and router pods are okay"