We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fc1c9a3 commit 653d631Copy full SHA for 653d631
.github/workflows/util/execute_and_retry.sh
@@ -3,16 +3,18 @@
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
+# $3: (Optional) Command for cleaning up resources if $2 fails
7
execute_and_retry () {
8
retry_counter=0
9
max_retry=$1
10
+ command=$2
11
+ cleanup=$3
12
while [ $retry_counter -lt $max_retry ]; do
13
attempt_failed=0
- eval "$2" || attempt_failed=$?
14
+ eval "$command" || attempt_failed=$?
15
16
if [ $attempt_failed -ne 0 ]; then
- eval "$3"
17
+ eval "$cleanup"
18
retry_counter=$(($retry_counter+1))
19
sleep 5
20
else
0 commit comments