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 b7df778 commit 8aa7eb5Copy full SHA for 8aa7eb5
.github/workflows/util/execute_and_retry.sh
@@ -1,13 +1,17 @@
1
#!/bin/bash
2
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
7
execute_and_retry () {
8
retry_counter=0
9
max_retry=$1
10
while [ $retry_counter -lt $max_retry ]; do
- deployment_failed=0
- eval "$2" || deployment_failed=$?
11
+ attempt_failed=0
12
+ eval "$2" || attempt_failed=$?
13
- if [ $deployment_failed -eq 1 ]; then
14
+ if [ $attempt_failed -eq 1 ]; then
15
eval "$3"
16
retry_counter=$(($retry_counter+1))
17
sleep 5
0 commit comments