Skip to content

Commit 7dc1965

Browse files
committed
refacotred
1 parent 66d9dba commit 7dc1965

4 files changed

Lines changed: 6 additions & 110 deletions

File tree

.github/workflows/run-samples.yml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ jobs:
129129
LOCALSTACK_AUTH_TOKEN: ${{ secrets.TEST_LOCALSTACK_AUTH_TOKEN }}
130130

131131
- name: Docker state snapshot
132-
# Capture the full Docker state on failure to diagnose missing web app containers.
132+
# Capture the full Docker state on failure
133133
if: failure()
134134
run: |
135135
echo "=== All Docker containers (running + stopped) ==="
@@ -149,17 +149,3 @@ jobs:
149149
if: always()
150150
run: make logs
151151

152-
- name: Get LocalStack Logs (webapp filtered)
153-
# Filtered view of LocalStack logs to surface web app container creation issues.
154-
if: failure()
155-
run: |
156-
LS_CONTAINER=$(docker ps --format "{{.Names}}" | grep -i "localstack" | head -1)
157-
if [ -n "$LS_CONTAINER" ]; then
158-
echo "=== LocalStack logs filtered for web app / container issues ==="
159-
docker logs "$LS_CONTAINER" 2>&1 | grep -iE "(ls-local-webapp|webapp.*deploy|container.*create|container.*start|pip.*install|requirements\.txt|cryptography|certificates|import.*error|module.*not.*found|build.*fail|gunicorn|flask|startup.*command|oryx|ModuleNotFoundError|Traceback)" | tail -200 || echo "(no matching lines)"
160-
echo ""
161-
echo "=== LocalStack logs filtered for ERROR/EXCEPTION ==="
162-
docker logs "$LS_CONTAINER" 2>&1 | grep -iE "(ERROR|EXCEPTION|FATAL|CRITICAL)" | tail -100 || echo "(no errors found)"
163-
else
164-
echo "No LocalStack container found"
165-
fi

run-samples.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ 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[@]}")
107-
ALL_SAMPLES=("${SAMPLES[@]}")
106+
ALL_SAMPLES=("${SAMPLES[@]}" "${TERRAFORM_SAMPLES[@]}" "${BICEP_SAMPLES[@]}")
108107
TOTAL=${#ALL_SAMPLES[@]}
109108
SHARD=${1:-1}
110109
SPLITS=${2:-1}

samples/web-app-sql-database/python/scripts/deploy.sh

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -479,48 +479,6 @@ else
479479
exit 1
480480
fi
481481

482-
# ============================================================
483-
# DEBUG: Post-deployment diagnostics
484-
# ============================================================
485-
echo "=== DEBUG: Post-deployment container state ==="
486-
487-
echo "--- All running Docker containers ---"
488-
docker ps --format "table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}" 2>&1
489-
490-
echo "--- All Docker containers (including stopped/exited) ---"
491-
docker ps -a --format "table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}" 2>&1
492-
493-
echo "--- Docker images ---"
494-
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}" 2>&1
495-
496-
# Find the LocalStack main container and show relevant logs
497-
LS_CONTAINER=$(docker ps --format "{{.Names}}" | grep -i "localstack" | head -1)
498-
if [ -n "$LS_CONTAINER" ]; then
499-
echo "--- LocalStack container [$LS_CONTAINER] logs (last 100 lines, filtered for webapp/container/deploy) ---"
500-
docker logs "$LS_CONTAINER" --tail 100 2>&1 | grep -iE "(webapp|container|deploy|error|exception|pip|install|cryptography|certificates|failed|build)" || echo "(no matching log lines found)"
501-
502-
echo "--- LocalStack container [$LS_CONTAINER] logs (last 50 lines, unfiltered) ---"
503-
docker logs "$LS_CONTAINER" --tail 50 2>&1
504-
else
505-
echo "WARNING: No LocalStack container found"
506-
fi
507-
508-
# Check for any recently exited containers
509-
EXITED_CONTAINERS=$(docker ps -a --filter "status=exited" --format "{{.Names}}\t{{.Image}}\t{{.Status}}" 2>&1)
510-
if [ -n "$EXITED_CONTAINERS" ]; then
511-
echo "--- Recently exited containers ---"
512-
echo "$EXITED_CONTAINERS"
513-
# Show logs from any exited container that might be the web app
514-
docker ps -a --filter "status=exited" --format "{{.Names}}" | while read -r c; do
515-
echo "--- Logs from exited container [$c] (last 30 lines) ---"
516-
docker logs "$c" --tail 30 2>&1
517-
done
518-
else
519-
echo "--- No exited containers found ---"
520-
fi
521-
522-
echo "=== END DEBUG: Post-deployment diagnostics ==="
523-
524482
# Get web app URL
525483
WEB_APP_URL=$($AZ webapp show \
526484
--name "$WEB_APP_NAME" \

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

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

106-
# Get the Docker container name (with retries, as the container may take time to start after deployment)
106+
# Get the Docker container name
107107
echo "Finding container name with prefix [ls-$web_app_name]..."
108-
MAX_RETRIES=18
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-
115-
# Print full diagnostics on first, every 6th, and last attempt
116-
if [ "$attempt" -eq 1 ] || [ "$((attempt % 6))" -eq 0 ] || [ "$attempt" -eq "$MAX_RETRIES" ]; then
117-
echo "=== DEBUG (attempt $attempt/$MAX_RETRIES): Container diagnostics ==="
118-
119-
echo "--- All running containers ---"
120-
docker ps --format "table {{.Names}}\t{{.Image}}\t{{.Status}}" 2>&1
121-
122-
echo "--- All containers (including stopped/exited) ---"
123-
docker ps -a --format "table {{.Names}}\t{{.Image}}\t{{.Status}}" 2>&1
124-
125-
echo "--- Docker images ---"
126-
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.ID}}" 2>&1
127-
128-
# Check LocalStack logs for web app container creation errors
129-
LS_CONTAINER=$(docker ps --format "{{.Names}}" | grep -i "localstack" | head -1)
130-
if [ -n "$LS_CONTAINER" ]; then
131-
echo "--- LocalStack logs (last 50 lines, filtered for webapp/container/error) ---"
132-
docker logs "$LS_CONTAINER" --tail 200 2>&1 | grep -iE "(ls-${web_app_name}|webapp.*container|container.*webapp|pip.*install|requirements|cryptography|certificates|import.*error|module.*not.*found|build.*fail|error.*build|startup|gunicorn|flask)" | tail -50 || echo "(no matching log lines)"
133-
134-
echo "--- LocalStack logs (last 30 lines, unfiltered) ---"
135-
docker logs "$LS_CONTAINER" --tail 30 2>&1
136-
fi
137-
138-
# Show logs from any exited containers
139-
EXITED=$(docker ps -a --filter "status=exited" --format "{{.Names}}" 2>/dev/null)
140-
if [ -n "$EXITED" ]; then
141-
echo "--- Exited container logs ---"
142-
echo "$EXITED" | while read -r c; do
143-
echo " [$c] logs (last 20 lines):"
144-
docker logs "$c" --tail 20 2>&1 | sed 's/^/ /'
145-
done
146-
fi
147-
148-
echo "=== END DEBUG ==="
149-
fi
150-
151-
if [ "$attempt" -lt "$MAX_RETRIES" ]; then
152-
echo "Attempt $attempt/$MAX_RETRIES: Container not found yet. Waiting ${RETRY_INTERVAL}s..."
153-
sleep "$RETRY_INTERVAL"
154-
fi
155-
done
108+
container_name=$(get_docker_container_name_by_prefix "ls-$web_app_name")
156109

157-
if [ -n "$container_name" ]; then
110+
if [ $? -eq 0 ] && [ -n "$container_name" ]; then
158111
echo "Container [$container_name] found successfully"
159112
else
160-
echo "Failed to get container name after $MAX_RETRIES attempts"
113+
echo "Failed to get container name"
161114
exit 1
162115
fi
163116

0 commit comments

Comments
 (0)