Skip to content

Commit 68600d3

Browse files
enhance Azure Web App validation with retry logic
1 parent 9919452 commit 68600d3

File tree

1 file changed

+48
-4
lines changed

1 file changed

+48
-4
lines changed

.github/workflows/CI.yml

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,55 @@ jobs:
213213
echo "Successfully increased TPM for Text Embedding deployment."
214214
fi
215215
216-
- name: Open Web App URL using chrome
216+
- name: Validate Azure Web App Deployment
217217
shell: bash
218218
run: |
219-
google-chrome --new-window "${{ steps.get_webapp_url.outputs.WEBAPP_URL }}"
220-
sleep 120
219+
webapp_url="${{ steps.get_webapp_url.outputs.WEBAPP_URL }}"
220+
echo "Validating Azure web app at: $webapp_url"
221+
222+
# Enhanced health check with retry logic
223+
max_attempts=5
224+
attempt=1
225+
success=false
226+
227+
while [ $attempt -le $max_attempts ] && [ "$success" = false ]; do
228+
echo "Attempt $attempt/$max_attempts: Checking web app health..."
229+
230+
# Check if web app responds
231+
http_code=$(curl -s -o /dev/null -w "%{http_code}" "$webapp_url" || echo "000")
232+
233+
if [ "$http_code" -eq 200 ]; then
234+
echo "✅ Web app is healthy (HTTP $http_code)"
235+
success=true
236+
237+
# Additional validation: check if it's actually the correct app
238+
response_body=$(curl -s "$webapp_url" | head -c 1000)
239+
if echo "$response_body" | grep -q "Document Knowledge Mining\|DKM\|Knowledge Mining"; then
240+
echo "✅ Web app content validated - Document Knowledge Mining solution detected"
241+
else
242+
echo "⚠️ Web app responding but content validation inconclusive"
243+
fi
244+
245+
elif [ "$http_code" -eq 404 ]; then
246+
echo "❌ Web app not found (HTTP 404)"
247+
break
248+
elif [ "$http_code" -eq 503 ] || [ "$http_code" -eq 502 ]; then
249+
echo "⚠️ Web app temporarily unavailable (HTTP $http_code), retrying..."
250+
sleep 15
251+
else
252+
echo "⚠️ Web app returned HTTP $http_code, retrying..."
253+
sleep 10
254+
fi
255+
256+
attempt=$((attempt + 1))
257+
done
258+
259+
if [ "$success" = false ]; then
260+
echo "❌ Web app validation failed after $max_attempts attempts"
261+
exit 1
262+
fi
263+
264+
echo "🎉 Azure web app deployment validated successfully!"
221265
222266
- name: Run Post Deployment Script
223267
shell: pwsh
@@ -280,7 +324,7 @@ jobs:
280324
if: env.RESOURCE_GROUP_NAME != ''
281325
shell: bash
282326
run: |
283-
sleep 120
327+
sleep 500
284328
az group delete --name ${{ env.RESOURCE_GROUP_NAME }} --yes --no-wait
285329
az group delete --name ${{ env.KUBERNETES_RESOURCE_GROUP_NAME }} --yes --no-wait
286330

0 commit comments

Comments
 (0)