@@ -325,10 +325,16 @@ jobs:
325325 - name : Run smoke tests
326326 run : |
327327 echo "β³ Waiting for deployment to be ready..."
328- sleep 45
328+ sleep 60
329329 echo "π Testing health endpoint..."
330330 DEPLOYMENT_URL="${{ steps.deploy-staging.outputs.deployment-url }}"
331331
332+ # Validate deployment URL is a full URL
333+ if [[ ! "$DEPLOYMENT_URL" =~ ^https?:// ]]; then
334+ echo "β Invalid deployment URL format: $DEPLOYMENT_URL"
335+ exit 1
336+ fi
337+
332338 # Try main health check with quick parameter (bypasses complex checks)
333339 echo "Testing main health check (quick mode): $DEPLOYMENT_URL/api/health?quick=true"
334340 if curl -f -s --max-time 30 "$DEPLOYMENT_URL/api/health?quick=true"; then
@@ -343,10 +349,25 @@ jobs:
343349 echo "Deployment URL: $DEPLOYMENT_URL"
344350 echo "Trying staging domain instead..."
345351 if [ -n "${{ secrets.STAGING_URL }}" ]; then
346- if curl -f -s --max-time 30 "${{ secrets.STAGING_URL }}/api/health?quick=true"; then
347- echo "β
Staging domain health check passed"
352+ STAGING_URL="${{ secrets.STAGING_URL }}"
353+ # Ensure staging URL is a full URL
354+ if [[ ! "$STAGING_URL" =~ ^https?:// ]]; then
355+ echo "β οΈ Staging URL is not a full URL: $STAGING_URL"
356+ STAGING_URL="https://$STAGING_URL"
357+ fi
358+
359+ echo "Testing staging domain reachability: $STAGING_URL"
360+ if curl -f -s --max-time 10 "$STAGING_URL" > /dev/null; then
361+ echo "β
Staging domain is reachable"
362+ echo "Trying staging domain health check: $STAGING_URL/api/health?quick=true"
363+ if curl -f -s --max-time 30 "$STAGING_URL/api/health?quick=true"; then
364+ echo "β
Staging domain health check passed"
365+ else
366+ echo "β Both deployment URL and staging domain failed"
367+ echo "β οΈ Health check failed but deployment was successful"
368+ fi
348369 else
349- echo "β Both deployment URL and staging domain failed "
370+ echo "β Staging domain is not publicly reachable: $STAGING_URL "
350371 echo "β οΈ Health check failed but deployment was successful"
351372 fi
352373 else
@@ -429,10 +450,16 @@ jobs:
429450 - name : Run production health check
430451 run : |
431452 echo "β³ Waiting for production deployment to be ready..."
432- sleep 45
453+ sleep 60
433454 echo "π Testing production health endpoint..."
434455 DEPLOYMENT_URL="${{ steps.deploy-production.outputs.deployment-url }}"
435456
457+ # Validate deployment URL is a full URL
458+ if [[ ! "$DEPLOYMENT_URL" =~ ^https?:// ]]; then
459+ echo "β Invalid deployment URL format: $DEPLOYMENT_URL"
460+ exit 1
461+ fi
462+
436463 # Try main health check with quick parameter (bypasses complex checks)
437464 echo "Testing main health check (quick mode): $DEPLOYMENT_URL/api/health?quick=true"
438465 if curl -f -s --max-time 30 "$DEPLOYMENT_URL/api/health?quick=true"; then
@@ -446,17 +473,30 @@ jobs:
446473 echo "β Full health check also failed"
447474 echo "Deployment URL: $DEPLOYMENT_URL"
448475
449- # Try production domain if available
476+ # Try production domain if available and publicly reachable
450477 if [ -n "${{ secrets.PRODUCTION_URL }}" ]; then
451- echo "Trying production domain: ${{ secrets.PRODUCTION_URL }}/api/health?quick=true"
452- if curl -f -s --max-time 30 "${{ secrets.PRODUCTION_URL }}/api/health?quick=true"; then
453- echo "β
Production domain health check passed"
478+ PROD_URL="${{ secrets.PRODUCTION_URL }}"
479+ # Ensure production URL is a full URL
480+ if [[ ! "$PROD_URL" =~ ^https?:// ]]; then
481+ echo "β οΈ Production URL is not a full URL: $PROD_URL"
482+ PROD_URL="https://$PROD_URL"
483+ fi
484+
485+ echo "Testing production domain reachability: $PROD_URL"
486+ if curl -f -s --max-time 10 "$PROD_URL" > /dev/null; then
487+ echo "β
Production domain is reachable"
488+ echo "Trying production domain health check: $PROD_URL/api/health?quick=true"
489+ if curl -f -s --max-time 30 "$PROD_URL/api/health?quick=true"; then
490+ echo "β
Production domain health check passed"
491+ else
492+ echo "β Production domain health check failed"
493+ echo "Both URLs failed - deployment may still be in progress"
494+ echo "Deployment URL: $DEPLOYMENT_URL"
495+ echo "Production URL: $PROD_URL"
496+ echo "β οΈ Health check failed but deployment was successful"
497+ fi
454498 else
455- echo "β Production domain health check also failed"
456- echo "Both URLs failed - deployment may still be in progress"
457- echo "Deployment URL: $DEPLOYMENT_URL"
458- echo "Production URL: ${{ secrets.PRODUCTION_URL }}"
459- # Don't fail the build - deployment was successful
499+ echo "β Production domain is not publicly reachable: $PROD_URL"
460500 echo "β οΈ Health check failed but deployment was successful"
461501 fi
462502 else
0 commit comments