-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mateusz Urbanek <[email protected]>
- Loading branch information
Showing
8 changed files
with
79 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
source .env | ||
|
||
# Define your command here | ||
command_to_run="tofu -chdir=./terraform/oci apply -auto-approve" | ||
|
||
# Function to generate a random sleep time between 1 and 5 seconds | ||
function jitter_backoff() { | ||
sleep_time=$(shuf -i 1-5 -n 1) | ||
echo "Sleeping for $sleep_time seconds before retrying..." | ||
sleep $sleep_time | ||
} | ||
|
||
# Loop to run the command until it succeeds | ||
while true; do | ||
export TF_VAR_availability_domain=$(shuf -i 1-3 -n 1) | ||
|
||
if $command_to_run ; then | ||
echo "Command completed successfully." | ||
break | ||
else | ||
echo "Command failed with exit code $exit_code. Retrying..." | ||
jitter_backoff | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
terraform { | ||
required_providers { | ||
oci = { | ||
source = "oracle/oci" | ||
source = "oracle/oci" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
terraform { | ||
required_providers { | ||
oci = { | ||
source = "oracle/oci" | ||
source = "oracle/oci" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters