Skip to content

Commit 695b7b8

Browse files
committed
added retries
1 parent 69ded6b commit 695b7b8

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

run-samples.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ BICEP_SAMPLES=(
103103

104104
# 4. Calculate Shard
105105
# Combine script-based, Terraform, and Bicep samples into one array
106-
ALL_SAMPLES=("${SAMPLES[@]}" "${TERRAFORM_SAMPLES[@]}" "${BICEP_SAMPLES[@]}")
106+
#ALL_SAMPLES=("${SAMPLES[@]}" "${TERRAFORM_SAMPLES[@]}" "${BICEP_SAMPLES[@]}")
107+
ALL_SAMPLES=("${SAMPLES[@]}")
107108
TOTAL=${#ALL_SAMPLES[@]}
108109
SHARD=${1:-1}
109110
SPLITS=${2:-1}

samples/web-app-sql-database/python/scripts/get-web-app-url.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,24 @@ call_web_app() {
103103
exit 1
104104
fi
105105

106-
# Get the Docker container name
106+
# Get the Docker container name (with retries, as the container may take time to start after deployment)
107107
echo "Finding container name with prefix [ls-$web_app_name]..."
108-
container_name=$(get_docker_container_name_by_prefix "ls-$web_app_name")
108+
MAX_RETRIES=30
109+
RETRY_INTERVAL=10
110+
container_name=""
111+
for ((attempt=1; attempt<=MAX_RETRIES; attempt++)); do
112+
container_name=$(get_docker_container_name_by_prefix "ls-$web_app_name") && break
113+
container_name=""
114+
if [ "$attempt" -lt "$MAX_RETRIES" ]; then
115+
echo "Attempt $attempt/$MAX_RETRIES: Container not found yet. Waiting ${RETRY_INTERVAL}s..."
116+
sleep "$RETRY_INTERVAL"
117+
fi
118+
done
109119

110-
if [ $? -eq 0 ] && [ -n "$container_name" ]; then
120+
if [ -n "$container_name" ]; then
111121
echo "Container [$container_name] found successfully"
112122
else
113-
echo "Failed to get container name"
123+
echo "Failed to get container name after $MAX_RETRIES attempts"
114124
exit 1
115125
fi
116126

0 commit comments

Comments
 (0)