Fix build

This commit is contained in:
2025-12-31 18:01:29 +07:00
parent cef86a5025
commit 55f09c3091
3 changed files with 214 additions and 39 deletions

View File

@@ -127,11 +127,59 @@ export TASK_ID="$TASK_ID"
export PORT_OFFSET="$PORT_OFFSET"
export TASK_SLOT="$TASK_SLOT"
# Change to AppHost directory
# Ensure HTTPS dev certificate is available (Aspire may need it even for HTTP mode)
echo "🔐 Ensuring HTTPS developer certificate is available..."
if ! dotnet dev-certs https --check > /dev/null 2>&1; then
echo " Generating HTTPS developer certificate..."
dotnet dev-certs https --trust > /dev/null 2>&1 || {
echo "⚠️ Could not generate/trust certificate"
echo " Will try to use HTTP-only profile"
}
fi
# Configure Aspire to use HTTP only (avoid certificate issues)
# Use the "http" launch profile which is configured for HTTP-only
export ASPNETCORE_URLS="http://localhost:15242"
export DOTNET_DASHBOARD_OTLP_ENDPOINT_URL="http://localhost:19204"
export DOTNET_RESOURCE_SERVICE_ENDPOINT_URL="http://localhost:20284"
export DOTNET_DASHBOARD_OTLP_HTTP_ENDPOINT_URL="http://localhost:19204"
export ASPNETCORE_ENVIRONMENT="Development"
export DOTNET_ENVIRONMENT="Development"
# Restore packages in the worktree first to ensure all dependencies are available
# This is important because Aspire will build projects that may reference worktree paths
echo ""
echo "📦 Restoring NuGet packages..."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# Restore at solution level in worktree if it exists
if [ -f "$WORKTREE_PROJECT_ROOT/src/Managing.sln" ]; then
echo " Restoring in worktree solution..."
cd "$WORKTREE_PROJECT_ROOT/src"
# Suppress all warnings and only show errors
dotnet restore Managing.sln --verbosity quiet --nologo 2>&1 | \
grep -vE "(warning|Warning|WARNING|NU[0-9]|\.csproj :)" || true
fi
# Restore at solution level in main repo (where we'll actually run from)
echo " Restoring in main repo solution..."
cd "$MAIN_REPO/src"
# Suppress all warnings and only show errors
RESTORE_OUTPUT=$(dotnet restore Managing.sln --verbosity quiet --nologo 2>&1 | \
grep -vE "(warning|Warning|WARNING|NU[0-9]|\.csproj :)" || true)
if echo "$RESTORE_OUTPUT" | grep -qE "(error|Error|ERROR|failed|Failed)"; then
echo "❌ Package restore failed:"
echo "$RESTORE_OUTPUT"
exit 1
else
echo "✅ Packages restored successfully"
fi
# Ensure we're in the AppHost directory for running Aspire
cd "$MAIN_REPO/src/Managing.AppHost"
echo ""
# Run Aspire (this will start the API and Workers)
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🚀 Starting Aspire..."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
@@ -141,8 +189,9 @@ echo ""
ASPIRE_LOG="$WORKTREE_PROJECT_ROOT/.task-pids/aspire-${TASK_ID}.log"
mkdir -p "$(dirname "$ASPIRE_LOG")"
# Start Aspire
dotnet run > "$ASPIRE_LOG" 2>&1 &
# Start Aspire using the "http" launch profile (HTTP only, no HTTPS)
# All output goes to log file (warnings will be filtered when displaying)
dotnet run --launch-profile http > "$ASPIRE_LOG" 2>&1 &
ASPIRE_PID=$!
# Save PID
@@ -201,9 +250,9 @@ for i in {1..120}; do
# Show progress every 10 seconds
if [ $((i % 10)) -eq 0 ]; then
echo " Still starting... (${i}/120 seconds)"
# Show last few lines of log for progress
# Show last few lines of log for progress (filter warnings)
if [ -f "$ASPIRE_LOG" ]; then
LAST_LINE=$(tail -1 "$ASPIRE_LOG" 2>/dev/null | cut -c1-80)
LAST_LINE=$(tail -20 "$ASPIRE_LOG" 2>/dev/null | grep -vE "(warning|Warning|WARNING|NU[0-9]|\.csproj :)" | tail -1 | cut -c1-80)
if [ -n "$LAST_LINE" ]; then
echo " Latest: $LAST_LINE"
fi
@@ -213,8 +262,8 @@ for i in {1..120}; do
if [ $i -eq 120 ]; then
echo "⚠️ Aspire dashboard did not become ready after 120 seconds"
echo "💡 Check the log: $ASPIRE_LOG"
echo "💡 Last 10 lines of log:"
tail -10 "$ASPIRE_LOG" 2>/dev/null || echo " (log file not found)"
echo "💡 Last 10 lines of log (warnings filtered):"
tail -30 "$ASPIRE_LOG" 2>/dev/null | grep -vE "(warning|Warning|WARNING|NU[0-9]|\.csproj :)" | tail -10 || echo " (log file not found)"
# Try to use default port anyway
if [ -z "$ASPIRE_DASHBOARD_URL" ]; then
ASPIRE_DASHBOARD_PORT=15242
@@ -269,10 +318,11 @@ echo " Health check: http://localhost:${API_PORT}/alive"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
# Tail the Aspire log
# Tail the Aspire log (filter out warnings for cleaner output)
echo "📋 Showing Aspire logs (Press Ctrl+C to stop)"
echo " (Warnings are hidden for cleaner output - full logs in: $ASPIRE_LOG)"
echo ""
tail -f "$ASPIRE_LOG" 2>/dev/null || {
tail -f "$ASPIRE_LOG" 2>/dev/null | grep -vE "(warning|Warning|WARNING|NU[0-9]|\.csproj :)" || {
echo "❌ Cannot read Aspire log: $ASPIRE_LOG"
echo "💡 Aspire may still be starting. Check the log manually."
exit 1