git.delta.rocks / unique-network / refs/commits / 2244ff0d2e83

difftreelog

ci(try-runtime) fix false-positive

Konstantin Astakhov2023-09-27parent: #448629b.patch.diff
in: master

1 file changed

modified.github/workflows/try-runtime.ymldiffbeforeafterboth
188188
189 - name: Check if docker logs consist logs related to Runtime Upgrade testing.189 - name: Check if docker logs consist logs related to Runtime Upgrade testing.
190 if: success()190 if: success()
191 run: |191 run: |
192 counter=300192 counter=300
193 counter_life=0193 counter_life=0
194 function check_container_status {194 function check_container_status {
195 docker inspect -f {{.State.Running}} try-runtime195 docker inspect -f {{.State.Running}} try-runtime
196 }196 }
197 function do_docker_logs {197 function do_docker_logs {
198 docker logs --details try-runtime 2>&1 | grep -i 'TryRuntime_on_runtime_upgrade executed without errors. Consumed'198 docker logs --details try-runtime 2>&1 | grep -i 'TryRuntime_on_runtime_upgrade executed without errors. Consumed'
199 }199 }
200 function is_started {200 function is_started {
201 if [ "$(check_container_status)" == "true" ]; then201 if [ "$(check_container_status)" == "true" ]; then
202 echo "Container: try-runtime RUNNING";202 echo "Container: try-runtime RUNNING";
203 echo "Check Docker logs"203 echo "Check Docker logs"
204 DOCKER_LOGS=$(do_docker_logs)204 DOCKER_LOGS=$(do_docker_logs)
205 if [[ -n ${DOCKER_LOGS} ]]; then205 if [[ -n ${DOCKER_LOGS} ]]; then
206 echo "TryRuntime_on_runtime_upgrade executed without errors."206 echo "TryRuntime_on_runtime_upgrade executed without errors."
207 return 0207 return 0
208 else208 else
209 echo "Message not found in logs output, repeating..."209 echo "Message not found in logs output, repeating..."
210 return 1210 return 1
211 fi211 fi
212 else212 else
213 DOCKER_LOGS=$(do_docker_logs)213 (( counter_life++ ))
214 while [ $counter_life -lt 3 ]
215 do
216 (( counter_life++ ))214 echo "Container try-runtime not RUNNING" $counter_life "time"
217 if [[ -n ${DOCKER_LOGS} ]]; then
218 echo "TryRuntime_on_runtime_upgrade executed without errors"
219 return 0
220 else
221 echo "Container try-runtime not RUNNING"
222 return 1215 return 1
223 fi216 fi
224 done217 }
225 fi
226 exit 0
227 }218
228219 while ! is_started; do
229 while ! is_started; do220 echo "Waiting for special message in log files "
230 echo "Waiting for special message in log files "221 sleep 30s
231 sleep 30s222 counter=$(( $counter - 1 ))
232 counter=$(( $counter - 1 ))223 echo "Counter: $counter"
233 echo "Counter: $counter"224 if [ "$counter" -gt "0" ] && [ "$counter_life" -lt "3" ]; then
234 if [ "$counter" -gt "0" ]; then225 continue
235 continue226 else
236 else227 echo "Counter reached zero, yet upgrade is not finished correctly or Container try-runtime is not RUNNING"
237 echo "Counter reached zero, yet upgrade is not finished"228 exit 1
238 exit 1229 fi
239 fi230 done
240 done231 echo "Halting script"
241 echo "Halting script"232 exit 0
242 exit 0
243 shell: bash233 shell: bash
244234
245 - name: Collect Docker Logs235 - name: Collect Docker Logs