-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathaction.yml
More file actions
83 lines (75 loc) · 3.06 KB
/
Copy pathaction.yml
File metadata and controls
83 lines (75 loc) · 3.06 KB
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
name: "Validate APIML Healthy"
description: "Validates APIML health using Gateway, Caching Service and Authentication Service health status"
inputs:
gateway-host:
description: "Gateway hostname"
required: false
default: "localhost"
zaas-host:
description: "ZAAS hostname"
required: false
default: "localhost"
caching-service:
description: "Check Caching Service health"
required: false
default: "false"
api-catalog:
description: "Check API Catalog health"
required: false
default: "false"
discoverable-client:
description: "Check Discoverable Client health"
required: false
default: "false"
runs:
using: "composite"
# if ZAAS Service and input services are not healthy after 3 minutes then exit
steps:
- name: Validate APIML setup
shell: bash
run: |
set +e # curl -s doesn't swallow the error alone
attemptCounter=1
maxAttempts=18
valid="false"
until [ $attemptCounter -gt $maxAttempts ]; do
sleep 10
gwHealth=$(curl -k -s https://${{ inputs.gateway-host }}:10010/application/health)
zaasHealth=$(curl -k -s https://${{ inputs.zaas-host }}:10023/application/health)
echo "Polling for GW health: $attemptCounter"
echo $gwHealth
gatewayUp=$(echo $gwHealth | jq -r '.status')
authUp=$(echo $gwHealth | jq -r '.components.gateway.details.zaas')
acUp="$(echo $gwHealth | jq -r '.components.gateway.details.apicatalog')"
csUp="DOWN"
csHealth="$(echo $zaasHealth | jq -r '[.components.discoveryComposite.components.discoveryClient.details.services[]] | index("cachingservice")')"
if [ "$csHealth" != "null" ]; then
csUp="UP"
fi
dcUp="DOWN"
dcHealth="$(echo $zaasHealth | jq -r '[.components.discoveryComposite.components.discoveryClient.details.services[]] | index("discoverableclient")')"
if [ "$dcHealth" != "null" ]; then
dcUp="UP"
fi
if [ "$gatewayUp" = "UP" ] && [ "$authUp" = "UP" ] && [ "$csUp" == "UP" ]; then
echo ">>>>>APIML is ready"
valid="true"
if [ ${{ inputs.caching-service }} != "false" ] && [ "$csUp" != "UP" ]; then
valid="false"
fi
if [ ${{ inputs.api-catalog }} != "false" ] && [ "$acUp" != "UP" ]; then
valid="false"
fi
if [ ${{ inputs.discoverable-client }} != "false" ] && [ "$dcUp" != "UP" ]; then
valid="false"
fi
fi
if [ "$valid" == "true" ]; then
break
fi
attemptCounter=$((attemptCounter+1))
done
if [ "$valid" != "true" ]; then
echo ">>>>>APIML is not ready"
exit 1
fi