Skip to content

Commit cc20484

Browse files
authored
ci: fix the check logic for Axon node status (#1446)
* Pause for 20 seconds to wait for the Axon node to start * Check axon node status every 10 seconds
1 parent 9d8137c commit cc20484

File tree

6 files changed

+110
-45
lines changed

6 files changed

+110
-45
lines changed

.github/workflows/openzeppelin_test_11.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,26 @@ jobs:
124124
125125
- name: Check Axon Status Before Test
126126
run: |
127-
response=$(curl -s -w "\n%{http_code}" http://localhost:8000 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"web3_clientVersion","params": [],"id":1}')
128-
http_code=$(echo "$response" | tail -n1)
129-
response_body=$(echo "$response" | sed '$d')
130-
if [[ "$http_code" -ne 200 ]]; then
131-
echo "Axon status check failed with HTTP status code: $http_code"
132-
exit 1
133-
else
134-
echo "$response_body"
135-
fi
127+
MAX_RETRIES=10
128+
for i in $(seq 1 $MAX_RETRIES); do
129+
sleep 10
130+
response=$(curl -s -w "\n%{http_code}" http://localhost:8000 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"web3_clientVersion","params": [],"id":1}')
131+
http_code=$(echo "$response" | tail -n1)
132+
response_body=$(echo "$response" | sed '$d')
133+
if [[ "$http_code" -eq 200 ]]; then
134+
echo "$response_body"
135+
exit 0
136+
else
137+
echo "Axon status check failed with HTTP status code: $http_code, retrying ($i/$MAX_RETRIES)"
138+
if [[ "$i" -eq $MAX_RETRIES ]]; then
139+
echo "Axon status check failed after $MAX_RETRIES attempts."
140+
exit 1
141+
fi
142+
fi
143+
done
136144
137145
- name: Run prepare
146+
if: success() || failure()
138147
id: runtest
139148
run: |
140149
cd /home/runner/work/axon/axon/openzeppelin-contracts

.github/workflows/openzeppelin_test_16_19.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,27 @@ jobs:
124124
125125
- name: Check Axon Status Before Test
126126
run: |
127-
response=$(curl -s -w "\n%{http_code}" http://localhost:8000 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"web3_clientVersion","params": [],"id":1}')
128-
http_code=$(echo "$response" | tail -n1)
129-
response_body=$(echo "$response" | sed '$d')
130-
if [[ "$http_code" -ne 200 ]]; then
131-
echo "Axon status check failed with HTTP status code: $http_code"
132-
exit 1
133-
else
134-
echo "$response_body"
135-
fi
127+
MAX_RETRIES=10
128+
for i in $(seq 1 $MAX_RETRIES); do
129+
sleep 10
130+
response=$(curl -s -w "\n%{http_code}" http://localhost:8000 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"web3_clientVersion","params": [],"id":1}')
131+
http_code=$(echo "$response" | tail -n1)
132+
response_body=$(echo "$response" | sed '$d')
133+
if [[ "$http_code" -eq 200 ]]; then
134+
echo "$response_body"
135+
exit 0
136+
else
137+
echo "Axon status check failed with HTTP status code: $http_code, retrying ($i/$MAX_RETRIES)"
138+
if [[ "$i" -eq $MAX_RETRIES ]]; then
139+
echo "Axon status check failed after $MAX_RETRIES attempts."
140+
exit 1
141+
fi
142+
fi
143+
done
136144
137145
- name: Run prepare
138146
id: runtest
147+
if: success() || failure()
139148
run: |
140149
cd /home/runner/work/axon/axon/openzeppelin-contracts
141150
npm install

.github/workflows/openzeppelin_test_1_5_and_12_15.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,26 @@ jobs:
125125
126126
- name: Check Axon Status Before Test
127127
run: |
128-
response=$(curl -s -w "\n%{http_code}" http://localhost:8000 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"web3_clientVersion","params": [],"id":1}')
129-
http_code=$(echo "$response" | tail -n1)
130-
response_body=$(echo "$response" | sed '$d')
131-
if [[ "$http_code" -ne 200 ]]; then
132-
echo "Axon status check failed with HTTP status code: $http_code"
133-
exit 1
134-
else
135-
echo "$response_body"
136-
fi
128+
MAX_RETRIES=10
129+
for i in $(seq 1 $MAX_RETRIES); do
130+
sleep 10
131+
response=$(curl -s -w "\n%{http_code}" http://localhost:8000 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"web3_clientVersion","params": [],"id":1}')
132+
http_code=$(echo "$response" | tail -n1)
133+
response_body=$(echo "$response" | sed '$d')
134+
if [[ "$http_code" -eq 200 ]]; then
135+
echo "$response_body"
136+
exit 0
137+
else
138+
echo "Axon status check failed with HTTP status code: $http_code, retrying ($i/$MAX_RETRIES)"
139+
if [[ "$i" -eq $MAX_RETRIES ]]; then
140+
echo "Axon status check failed after $MAX_RETRIES attempts."
141+
exit 1
142+
fi
143+
fi
144+
done
137145
138146
- name: Run prepare
147+
if: success() || failure()
139148
id: runtest
140149
run: |
141150
cd /home/runner/work/axon/axon/openzeppelin-contracts

.github/workflows/openzeppelin_test_6_10.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,26 @@ jobs:
124124
125125
- name: Check Axon Status Before Test
126126
run: |
127-
response=$(curl -s -w "\n%{http_code}" http://localhost:8000 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"web3_clientVersion","params": [],"id":1}')
128-
http_code=$(echo "$response" | tail -n1)
129-
response_body=$(echo "$response" | sed '$d')
130-
if [[ "$http_code" -ne 200 ]]; then
131-
echo "Axon status check failed with HTTP status code: $http_code"
132-
exit 1
133-
else
134-
echo "$response_body"
135-
fi
127+
MAX_RETRIES=10
128+
for i in $(seq 1 $MAX_RETRIES); do
129+
sleep 10
130+
response=$(curl -s -w "\n%{http_code}" http://localhost:8000 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"web3_clientVersion","params": [],"id":1}')
131+
http_code=$(echo "$response" | tail -n1)
132+
response_body=$(echo "$response" | sed '$d')
133+
if [[ "$http_code" -eq 200 ]]; then
134+
echo "$response_body"
135+
exit 0
136+
else
137+
echo "Axon status check failed with HTTP status code: $http_code, retrying ($i/$MAX_RETRIES)"
138+
if [[ "$i" -eq $MAX_RETRIES ]]; then
139+
echo "Axon status check failed after $MAX_RETRIES attempts."
140+
exit 1
141+
fi
142+
fi
143+
done
136144
137145
- name: Run prepare
146+
if: success() || failure()
138147
id: runtest
139148
run: |
140149
cd /home/runner/work/axon/axon/openzeppelin-contracts

.github/workflows/v3_core_test.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,23 @@ jobs:
112112
113113
- name: Check Axon Status Before Test
114114
run: |
115-
response=$(curl -s -w "\n%{http_code}" http://localhost:8000 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"web3_clientVersion","params": [],"id":1}')
116-
http_code=$(echo "$response" | tail -n1)
117-
response_body=$(echo "$response" | sed '$d')
118-
if [[ "$http_code" -ne 200 ]]; then
119-
echo "Axon status check failed with HTTP status code: $http_code"
120-
exit 1
121-
else
122-
echo "$response_body"
123-
fi
115+
MAX_RETRIES=10
116+
for i in $(seq 1 $MAX_RETRIES); do
117+
sleep 10
118+
response=$(curl -s -w "\n%{http_code}" http://localhost:8000 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"web3_clientVersion","params": [],"id":1}')
119+
http_code=$(echo "$response" | tail -n1)
120+
response_body=$(echo "$response" | sed '$d')
121+
if [[ "$http_code" -eq 200 ]]; then
122+
echo "$response_body"
123+
exit 0
124+
else
125+
echo "Axon status check failed with HTTP status code: $http_code, retrying ($i/$MAX_RETRIES)"
126+
if [[ "$i" -eq $MAX_RETRIES ]]; then
127+
echo "Axon status check failed after $MAX_RETRIES attempts."
128+
exit 1
129+
fi
130+
fi
131+
done
124132
125133
- name: Install dependencies
126134
run: |
@@ -132,6 +140,7 @@ jobs:
132140
cd /home/runner/work/axon/axon/v3-core
133141
yarn compile
134142
- name: Run tests 0
143+
if: success() || failure()
135144
id: runtest
136145
run: |
137146
cd /home/runner/work/axon/axon/v3-core

.github/workflows/web3_compatible.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,26 @@ jobs:
7575
--config devtools/chain/config.toml \
7676
>> /tmp/log 2>&1 &
7777
78+
- name: Check Axon Status Before Test
79+
run: |
80+
MAX_RETRIES=10
81+
for i in $(seq 1 $MAX_RETRIES); do
82+
sleep 10
83+
response=$(curl -s -w "\n%{http_code}" http://localhost:8000 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"web3_clientVersion","params": [],"id":1}')
84+
http_code=$(echo "$response" | tail -n1)
85+
response_body=$(echo "$response" | sed '$d')
86+
if [[ "$http_code" -eq 200 ]]; then
87+
echo "$response_body"
88+
exit 0
89+
else
90+
echo "Axon status check failed with HTTP status code: $http_code, retrying ($i/$MAX_RETRIES)"
91+
if [[ "$i" -eq $MAX_RETRIES ]]; then
92+
echo "Axon status check failed after $MAX_RETRIES attempts."
93+
exit 1
94+
fi
95+
fi
96+
done
97+
7898
- name: Checkout gpBlockchain/axon-test
7999
uses: actions/checkout@v4
80100
with:

0 commit comments

Comments
 (0)