This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
66 lines (56 loc) · 2.03 KB
/
mev-commit-infra-test.yml
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
name: Deploy and Test mev-commit infra
on:
workflow_run:
workflows: ["mev-commit-ci"]
types:
- completed
jobs:
deploy_and_test:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install jq
run: |
sudo apt-get update
sudo apt-get install -y jq
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Set up Docker Compose
run: |
sudo rm /usr/local/bin/docker-compose
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
- name: Build and Start Services
run: |
docker-compose -f docker-compose.yml up -d
- name: Check Service Endpoints
run: |
ips=("172.29.9.100" "172.29.9.101" "172.29.9.102") # Example IP addresses, adjust as needed
for ip in "${ips[@]}"; do
echo "Checking service at $ip"
success=false
attempts=0
while [ $attempts -lt 3 ]; do
response=$(curl -s "$ip:13523/topology")
buildersCount=$(echo "$response" | jq '.connected_peers.builders | length')
searchersCount=$(echo "$response" | jq '.connected_peers.searchers | length')
if [[ -n "$response" && "$buildersCount" -gt 0 || "$searchersCount" -gt 0 ]]; then
echo "Service at $ip is OK"
success=true
break
else
echo "Service check failed for $ip. Retrying in 30 seconds..."
attempts=$(( $attempts + 1 ))
sleep 30
fi
done
if [ "$success" == "false" ]; then
echo "Service check failed for $ip after 3 attempts, failing"
exit 1
fi
done
- name: Stop Services
run: |
docker-compose -f docker-compose.yml down