@@ -416,7 +416,56 @@ jobs:
416416 )
417417
418418 echo "Deploying with command: gcloud run deploy ${DEPLOY_ARGS[*]}"
419- gcloud run deploy "${DEPLOY_ARGS[@]}"
419+ echo "Environment variables being set: ${ENV_VARS}"
420+ echo ""
421+ echo "Note: If deployment fails, check Cloud Run logs for startup errors"
422+ echo ""
423+
424+ # Deploy the service and capture output
425+ DEPLOY_STDOUT=$(gcloud run deploy "${DEPLOY_ARGS[@]}" 2>&1)
426+ DEPLOY_EXIT_CODE=$?
427+
428+ if [ ${DEPLOY_EXIT_CODE} -ne 0 ]; then
429+ echo "Error: Deployment failed with exit code ${DEPLOY_EXIT_CODE}"
430+ echo "Deployment output:"
431+ echo "${DEPLOY_STDOUT}"
432+ echo ""
433+ echo "Checking service status..."
434+ gcloud run services describe supply-graph-ai \
435+ --region="${{ env.GCP_REGION }}" \
436+ --project="${PROJECT_ID}" \
437+ --format="yaml(status)" || true
438+ exit 1
439+ fi
440+
441+ echo "Deployment output:"
442+ echo "${DEPLOY_STDOUT}"
443+ echo ""
444+
445+ # Get the service URL after successful deployment
446+ echo "Getting service URL..."
447+ DEPLOY_OUTPUT=$(gcloud run services describe supply-graph-ai \
448+ --region="${{ env.GCP_REGION }}" \
449+ --project="${PROJECT_ID}" \
450+ --format="value(status.url)" 2>/dev/null || echo "")
451+
452+ if [ -z "${DEPLOY_OUTPUT}" ]; then
453+ echo "Warning: Could not get URL from service describe, trying service list..."
454+ DEPLOY_OUTPUT=$(gcloud run services list \
455+ --filter="metadata.name=supply-graph-ai" \
456+ --region="${{ env.GCP_REGION }}" \
457+ --project="${PROJECT_ID}" \
458+ --format="value(status.url)" 2>/dev/null || echo "")
459+ fi
460+
461+ if [ -n "${DEPLOY_OUTPUT}" ]; then
462+ echo "✅ Service deployed successfully. URL: ${DEPLOY_OUTPUT}"
463+ echo "url=${DEPLOY_OUTPUT}" >> $GITHUB_OUTPUT
464+ else
465+ echo "Error: Could not determine service URL after deployment"
466+ echo "This might indicate the deployment didn't complete successfully"
467+ exit 1
468+ fi
420469
421470 - name : Run smoke tests
422471 run : |
0 commit comments