@@ -179,6 +179,13 @@ Function Nuke-Everything {
179179 }
180180 }
181181
182+ # Kill any spurious containerd.
183+ $pids = $ (get-process | where-object {$_.ProcessName -like ' containerd' }).id
184+ foreach ($p in $pids ) {
185+ Write-Host " INFO: Killing containerd with PID $p "
186+ Stop-Process - Id $p - Force - ErrorAction SilentlyContinue
187+ }
188+
182189 Stop-Process - name " cc1" - Force - ErrorAction SilentlyContinue 2>&1 | Out-Null
183190 Stop-Process - name " link" - Force - ErrorAction SilentlyContinue 2>&1 | Out-Null
184191 Stop-Process - name " compile" - Force - ErrorAction SilentlyContinue 2>&1 | Out-Null
@@ -521,6 +528,15 @@ Try {
521528 Throw " ERROR: gotestsum.exe not found...." `
522529 }
523530
531+ docker cp " $COMMITHASH `:c`:\containerd\bin\containerd.exe" $env: TEMP \binary\
532+ if (-not (Test-Path " $env: TEMP \binary\containerd.exe" )) {
533+ Throw " ERROR: containerd.exe not found...." `
534+ }
535+ docker cp " $COMMITHASH `:c`:\containerd\bin\containerd-shim-runhcs-v1.exe" $env: TEMP \binary\
536+ if (-not (Test-Path " $env: TEMP \binary\containerd-shim-runhcs-v1.exe" )) {
537+ Throw " ERROR: containerd-shim-runhcs-v1.exe not found...." `
538+ }
539+
524540 $ErrorActionPreference = " Stop"
525541
526542 # Copy the built dockerd.exe to dockerd-$COMMITHASH.exe so that easily spotted in task manager.
@@ -594,6 +610,12 @@ Try {
594610 $dutArgs += " -D"
595611 }
596612
613+ # Arguments: Are we starting the daemon under test in containerd mode?
614+ if (-not (" $env: DOCKER_WINDOWS_CONTAINERD_RUNTIME " -eq " " )) {
615+ Write-Host - ForegroundColor Green " INFO: Running the daemon under test in containerd mode"
616+ $dutArgs += " --containerd \\.\pipe\containerd-containerd"
617+ }
618+
597619 # Arguments: Are we starting the daemon under test with Hyper-V containers as the default isolation?
598620 if (-not (" $env: DOCKER_DUT_HYPERV " -eq " " )) {
599621 Write-Host - ForegroundColor Green " INFO: Running the daemon under test with Hyper-V containers as the default"
@@ -616,6 +638,15 @@ Try {
616638 Write-Host - ForegroundColor Green " INFO: Args: $dutArgs "
617639 New-Item - ItemType Directory $env: TEMP \daemon - ErrorAction SilentlyContinue | Out-Null
618640
641+ # Start containerd first
642+ if (-not (" $env: DOCKER_WINDOWS_CONTAINERD_RUNTIME " -eq " " )) {
643+ Start-Process " $env: TEMP \binary\containerd.exe" `
644+ - ArgumentList " --log-level debug" `
645+ - RedirectStandardOutput " $env: TEMP \containerd.out" `
646+ - RedirectStandardError " $env: TEMP \containerd.err"
647+ Write-Host - ForegroundColor Green " INFO: Containerd started successfully."
648+ }
649+
619650 # Cannot fathom why, but always writes to stderr....
620651 Start-Process " $env: TEMP \binary\dockerd-$COMMITHASH " `
621652 - ArgumentList $dutArgs `
@@ -943,6 +974,15 @@ Finally {
943974 Copy-Item " $env: TEMP \dut.out" " bundles\CIDUT.out" - Force - ErrorAction SilentlyContinue
944975 Write-Host - ForegroundColor Green " INFO: Saving daemon under test log ($env: TEMP \dut.err) to bundles\CIDUT.err"
945976 Copy-Item " $env: TEMP \dut.err" " bundles\CIDUT.err" - Force - ErrorAction SilentlyContinue
977+
978+ Write-Host - ForegroundColor Green " INFO: Saving containerd logs to bundles"
979+ if (Test-Path - Path " $env: TEMP \containerd.out" ) {
980+ Copy-Item " $env: TEMP \containerd.out" " bundles\containerd.out" - Force - ErrorAction SilentlyContinue
981+ Copy-Item " $env: TEMP \containerd.err" " bundles\containerd.err" - Force - ErrorAction SilentlyContinue
982+ } else {
983+ " " | Out-File - FilePath " bundles\containerd.out"
984+ " " | Out-File - FilePath " bundles\containerd.err"
985+ }
946986 }
947987
948988 Set-Location " $env: SOURCES_DRIVE \$env: SOURCES_SUBDIR " - ErrorAction SilentlyContinue
0 commit comments