You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: azure-pipelines.yml
+17-8Lines changed: 17 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -264,21 +264,30 @@ jobs:
264
264
265
265
# Wait for SQL Server to be ready
266
266
echo "Waiting for SQL Server to start..."
267
-
for i in {1..60}; do
268
-
if docker exec $(docker ps -q --filter ancestor=mcr.microsoft.com/mssql/server:2022-latest) /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $(TestAppPassword) -Q "SELECT 1" > /dev/null 2>&1; then
269
-
echo "SQL Server is ready after $i attempts"
267
+
268
+
# First, wait for the container to be running and SQL Server service to be listening
269
+
for i in {1..30}; do
270
+
if docker logs $(docker ps -q --filter ancestor=mcr.microsoft.com/mssql/server:2022-latest) 2>&1 | grep -q "SQL Server is now ready for client connections"; then
271
+
echo "SQL Server service is ready after $i attempts ($(($i * 2)) seconds)"
270
272
break
271
273
fi
272
-
echo "Attempt $i: SQL Server not ready yet, waiting 5 seconds..."
273
-
sleep 5
274
+
echo "Attempt $i: Waiting for SQL Server service to be ready, checking again in 2 seconds..."
275
+
sleep 2
274
276
done
275
277
276
-
# Final verification
277
-
if ! docker exec $(docker ps -q --filter ancestor=mcr.microsoft.com/mssql/server:2022-latest) /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $(TestAppPassword) -Q "SELECT 1" > /dev/null 2>&1; then
278
-
echo "SQL Server failed to start properly after 5 minutes"
278
+
# Additional wait to ensure full initialization
279
+
echo "Waiting additional 10 seconds for full SQL Server initialization..."
280
+
sleep 10
281
+
282
+
# Verify we can connect using a simple network test first
283
+
echo "Testing SQL Server connectivity..."
284
+
if ! timeout 30 bash -c 'until echo > /dev/tcp/localhost/1433; do sleep 1; done'; then
0 commit comments