Make Windows Dev Drive setup use existing volumes

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
starr-openai
2026-05-06 19:29:58 -07:00
parent c9453136bd
commit f5c6dd59a0

View File

@@ -1,35 +1,14 @@
# Configure a fast drive for Windows CI jobs.
#
# If the runner already exposes `D:`, prefer it directly. Otherwise create a
# small Dev Drive VHD and use that mount point for temp-heavy work.
# If the runner already exposes `D:`, prefer it directly. Otherwise fall back
# to `C:` without trying to provision a new volume in CI.
if (Test-Path "D:\") {
Write-Output "Using existing drive at D:"
$Drive = "D:"
} else {
try {
$VhdPath = "C:/codex_dev_drive.vhdx"
$Volume = New-VHD -Path $VhdPath -SizeBytes 20GB -ErrorAction Stop |
Mount-VHD -Passthru -ErrorAction Stop |
Initialize-Disk -Passthru -ErrorAction Stop |
New-Partition -AssignDriveLetter -UseMaximumSize -ErrorAction Stop |
Format-Volume -DevDrive -Confirm:$false -Force -ErrorAction Stop
$Drive = "$($Volume.DriveLetter):"
fsutil devdrv trust $Drive
fsutil devdrv enable /disallowAv
Dismount-VHD -Path $VhdPath
Mount-VHD -Path $VhdPath
Write-Output $Volume
fsutil devdrv query $Drive
Write-Output "Using Dev Drive at $Drive"
} catch {
Write-Warning "Failed to create Dev Drive, falling back to C:. $($_.Exception.Message)"
$Drive = "C:"
}
Write-Warning "No D: drive available; falling back to C:"
$Drive = "C:"
}
$Tmp = "$Drive\codex-tmp"