Skip to content

Commit 8aa7eb5

Browse files
committed
Add comments to the execute_and_retry.sh
1 parent b7df778 commit 8aa7eb5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/util/execute_and_retry.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
#!/bin/bash
22

3+
# This function is for retrying commands in the case they fail. It accepts three arguments
4+
# $1: Number of retries it will attempt
5+
# $2: Command to execute
6+
# $3: Clean up commands
37
execute_and_retry () {
48
retry_counter=0
59
max_retry=$1
610
while [ $retry_counter -lt $max_retry ]; do
7-
deployment_failed=0
8-
eval "$2" || deployment_failed=$?
11+
attempt_failed=0
12+
eval "$2" || attempt_failed=$?
913

10-
if [ $deployment_failed -eq 1 ]; then
14+
if [ $attempt_failed -eq 1 ]; then
1115
eval "$3"
1216
retry_counter=$(($retry_counter+1))
1317
sleep 5

0 commit comments

Comments
 (0)