mirror of
https://github.com/actions/runner-images.git
synced 2025-12-28 04:38:53 +08:00
[Windows] Add WSL2 to Windows-2025 image (#11242)
This commit is contained in:
@@ -93,11 +93,11 @@ $servicesToDisable = @(
|
||||
'wuauserv'
|
||||
'DiagTrack'
|
||||
'dmwappushservice'
|
||||
'PcaSvc'
|
||||
$(if(-not (Test-IsWin25)){'PcaSvc'})
|
||||
'SysMain'
|
||||
'gupdate'
|
||||
'gupdatem'
|
||||
'StorSvc'
|
||||
$(if(-not (Test-IsWin25)){'StorSvc'})
|
||||
) | Get-Service -ErrorAction SilentlyContinue
|
||||
Stop-Service $servicesToDisable
|
||||
$servicesToDisable.WaitForStatus('Stopped', "00:01:00")
|
||||
|
||||
16
images/windows/scripts/build/Install-WSL2.ps1
Normal file
16
images/windows/scripts/build/Install-WSL2.ps1
Normal file
@@ -0,0 +1,16 @@
|
||||
Write-Host "Install WSL2"
|
||||
|
||||
$version = (Get-GithubReleasesByVersion -Repo "microsoft/WSL" -Version "latest").version
|
||||
$downloadUrl = Resolve-GithubReleaseAssetUrl `
|
||||
-Repo "microsoft/WSL" `
|
||||
-Version $version `
|
||||
-UrlMatchPattern "wsl.*.x64.msi"
|
||||
|
||||
Install-Binary -Type MSI `
|
||||
-Url $downloadUrl `
|
||||
-ExpectedSHA256Sum "CD3F2A68A1A5836F6A1CC9965A7F5F54DB267CA221EAA87DF29345AB7957AEC4"
|
||||
|
||||
Write-Host "Performing wsl --install --no-distribution"
|
||||
wsl.exe --install --no-distribution
|
||||
|
||||
Invoke-PesterTests -TestFile "WindowsFeatures" -TestName "WSL2"
|
||||
Reference in New Issue
Block a user