Skip to content

Commit e7d2a09

Browse files
committed
attempt 2 to fix ci/cd for windows
1 parent 328c10c commit e7d2a09

1 file changed

Lines changed: 36 additions & 5 deletions

File tree

.github/workflows/integration-tests.yml

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,44 @@ jobs:
3434
Write-Host "Checking Docker version..."
3535
docker version
3636
37-
Write-Host "Switching to Linux containers..."
38-
& "C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchLinuxEngine
37+
Write-Host "Checking Docker daemon info..."
38+
docker info
3939
40-
Start-Sleep -Seconds 10
40+
$osType = docker info --format '{{.OSType}}'
41+
Write-Host "Current OSType: $osType"
4142
42-
Write-Host "Verifying Docker is in Linux mode..."
43-
docker info | Select-String -Pattern "OSType"
43+
if ($osType -ne "linux") {
44+
Write-Host "Docker is in Windows mode, switching to Linux mode..."
45+
46+
# Stop Docker service
47+
Stop-Service -Name docker -Force -ErrorAction SilentlyContinue
48+
49+
# Wait for service to stop
50+
Start-Sleep -Seconds 5
51+
52+
# Start Docker service
53+
Start-Service -Name docker
54+
55+
# Wait for Docker to be ready
56+
$maxAttempts = 30
57+
$attempt = 0
58+
while ($attempt -lt $maxAttempts) {
59+
try {
60+
docker info | Out-Null
61+
Write-Host "Docker is ready"
62+
break
63+
} catch {
64+
$attempt++
65+
Write-Host "Waiting for Docker to be ready... (attempt $attempt/$maxAttempts)"
66+
Start-Sleep -Seconds 2
67+
}
68+
}
69+
70+
$osType = docker info --format '{{.OSType}}'
71+
Write-Host "OSType after restart: $osType"
72+
} else {
73+
Write-Host "Docker is already in Linux mode"
74+
}
4475
4576
Write-Host "Testing Linux container pull..."
4677
docker pull alpine:latest

0 commit comments

Comments
 (0)