Skip to content

Commit e3ba729

Browse files
[Windows] Add Windows 2025 code (#11037)
1 parent 6c76883 commit e3ba729

25 files changed

+994
-81
lines changed

images/windows/scripts/build/Configure-ImageDataFile.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ $imageMinorVersion = $imageVersionComponents[1]
1515
$imageDataFile = $env:IMAGEDATA_FILE
1616
$githubUrl = "https://github.com/actions/runner-images/blob"
1717

18-
if (Test-IsWin22) {
18+
if (Test-IsWin25) {
19+
$imageLabel = "windows-2025"
20+
$softwareUrl = "${githubUrl}/win25/$imageMajorVersion.$imageMinorVersion/images/windows/Windows2025-Readme.md"
21+
$releaseUrl = "https://github.com/actions/runner-images/releases/tag/win25%2F$imageMajorVersion.$imageMinorVersion"
22+
} elseif (Test-IsWin22) {
1923
$imageLabel = "windows-2022"
2024
$softwareUrl = "${githubUrl}/win22/$imageMajorVersion.$imageMinorVersion/images/windows/Windows2022-Readme.md"
2125
$releaseUrl = "https://github.com/actions/runner-images/releases/tag/win22%2F$imageMajorVersion.$imageMinorVersion"

images/windows/scripts/build/Configure-User.ps1

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,26 @@ if ($LASTEXITCODE -ne 0) {
2727
throw "Failed to copy HKCU\Software\Microsoft\VisualStudio to HKLM\DEFAULT\Software\Microsoft\VisualStudio"
2828
}
2929

30-
# disable TSVNCache.exe
31-
$registryKeyPath = 'HKCU:\Software\TortoiseSVN'
32-
if (-not(Test-Path -Path $registryKeyPath)) {
33-
New-Item -Path $registryKeyPath -ItemType Directory -Force
30+
# TortoiseSVN not installed on Windows 2025 image due to Sysprep issues
31+
if (-not (Test-IsWin25)) {
32+
# disable TSVNCache.exe
33+
$registryKeyPath = 'HKCU:\Software\TortoiseSVN'
34+
if (-not(Test-Path -Path $registryKeyPath)) {
35+
New-Item -Path $registryKeyPath -ItemType Directory -Force
36+
}
37+
38+
New-ItemProperty -Path $registryKeyPath -Name CacheType -PropertyType DWORD -Value 0
39+
reg.exe copy HKCU\Software\TortoiseSVN HKLM\DEFAULT\Software\TortoiseSVN /s
40+
if ($LASTEXITCODE -ne 0) {
41+
throw "Failed to copy HKCU\Software\TortoiseSVN to HKLM\DEFAULT\Software\TortoiseSVN"
42+
}
3443
}
44+
Dismount-RegistryHive "HKLM\DEFAULT"
3545

36-
New-ItemProperty -Path $registryKeyPath -Name CacheType -PropertyType DWORD -Value 0
37-
reg.exe copy HKCU\Software\TortoiseSVN HKLM\DEFAULT\Software\TortoiseSVN /s
38-
if ($LASTEXITCODE -ne 0) {
39-
throw "Failed to copy HKCU\Software\TortoiseSVN to HKLM\DEFAULT\Software\TortoiseSVN"
46+
# Remove the "installer" (var.install_user) user profile for Windows 2025 image
47+
if (Test-IsWin25) {
48+
Get-CimInstance -ClassName Win32_UserProfile | where-object {$_.LocalPath -match $env:INSTALL_USER} | Remove-CimInstance -Confirm:$false
49+
& net user $env:INSTALL_USER /DELETE
4050
}
4151

42-
Dismount-RegistryHive "HKLM\DEFAULT"
43-
4452
Write-Host "Configure-User.ps1 - completed"

images/windows/scripts/build/Install-Docker.ps1

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,18 @@ if ($LastExitCode -ne 0) {
4141
# https://github.com/Azure/azure-cli/issues/18766
4242
New-Item -ItemType SymbolicLink -Path "C:\Windows\SysWOW64\docker.exe" -Target "C:\Windows\System32\docker.exe"
4343

44-
Write-Host "Download docker images"
45-
$dockerImages = (Get-ToolsetContent).docker.images
46-
foreach ($dockerImage in $dockerImages) {
47-
Write-Host "Pulling docker image $dockerImage ..."
48-
docker pull $dockerImage
49-
50-
if (!$?) {
51-
throw "Docker pull failed with a non-zero exit code ($LastExitCode)"
44+
if (-not (Test-IsWin25)) {
45+
Write-Host "Download docker images"
46+
$dockerImages = (Get-ToolsetContent).docker.images
47+
foreach ($dockerImage in $dockerImages) {
48+
Write-Host "Pulling docker image $dockerImage ..."
49+
docker pull $dockerImage
50+
51+
if (!$?) {
52+
throw "Docker pull failed with a non-zero exit code ($LastExitCode)"
53+
}
5254
}
55+
Invoke-PesterTests -TestFile "Docker" -TestName "DockerImages"
5356
}
5457

5558
Invoke-PesterTests -TestFile "Docker" -TestName "Docker"
56-
Invoke-PesterTests -TestFile "Docker" -TestName "DockerImages"

images/windows/scripts/build/Install-Haskell.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ Add-MachinePathItem "$ghcupPrefix\ghcup\bin"
2929
Add-MachinePathItem "$cabalDir\bin"
3030
Update-Environment
3131

32-
# Get 3 latest versions of GHC
32+
# Get 1 or 3 latest versions of GHC depending on the OS version
33+
If (Test-IsWin25) {
34+
$numberOfVersions = 1
35+
} else {
36+
$numberOfVersions = 3
37+
}
3338
$versions = ghcup list -t ghc -r | Where-Object { $_ -notlike "prerelease" }
3439
$versionsOutput = [version[]]($versions | ForEach-Object { $_.Split(' ')[1]; })
35-
$latestMajorMinor = $versionsOutput | Group-Object { $_.ToString(2) } | Sort-Object { [Version] $_.Name } | Select-Object -last 3
40+
$latestMajorMinor = $versionsOutput | Group-Object { $_.ToString(2) } | Sort-Object { [Version] $_.Name } | Select-Object -last $numberOfVersions
3641
$versionsList = $latestMajorMinor | ForEach-Object { $_.Group | Select-Object -Last 1 } | Sort-Object
3742

3843
# The latest version will be installed as a default

images/windows/scripts/build/Install-Mingw64.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ if (Test-IsWin19) {
2727
$path = "C:\$_\bin\mingw32-make.exe" | Get-Item
2828
Copy-Item -Path $path -Destination (Join-Path $path.Directory 'make.exe')
2929
}
30-
30+
3131
Add-MachinePathItem "C:\mingw64\bin"
3232

3333
}
3434

35-
if (Test-IsWin22) {
36-
# If Windows 2022, install version specified in the toolset
35+
if (-not (Test-IsWin19)) {
36+
# If Windows 2022 0r 2025 install version specified in the toolset
3737
$version = (Get-ToolsetContent).mingw.version
3838
$runtime = (Get-ToolsetContent).mingw.runtime
3939

images/windows/scripts/build/Install-MongoDB.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,18 @@ $mongodbService.WaitForStatus('Running', '00:01:00')
3939
Stop-Service $mongodbService
4040
$mongodbService | Set-Service -StartupType Disabled
4141

42+
# Install mongodb shell for mongodb > 5 version
43+
if (Test-IsWin25) {
44+
$mongoshVersion = (Get-GithubReleasesByVersion -Repo "mongodb-js/mongosh" -Version "latest").version
45+
46+
$mongoshDownloadUrl = Resolve-GithubReleaseAssetUrl `
47+
-Repo "mongodb-js/mongosh" `
48+
-Version $mongoshVersion `
49+
-UrlMatchPattern "mongosh-*-x64.msi"
50+
51+
Install-Binary -Type MSI `
52+
-Url $mongoshDownloadUrl `
53+
-ExpectedSignature 'F2D7C28591847BB2CB2B1C2A0C59459FDC728A38'
54+
}
55+
4256
Invoke-PesterTests -TestFile "Databases" -TestName "MongoDB"

images/windows/scripts/build/Install-Rust.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ rustup component add rustfmt clippy
3939
if ($LASTEXITCODE -ne 0) {
4040
throw "Rust component installation failed with exit code $LASTEXITCODE"
4141
}
42-
43-
cargo install bindgen-cli cbindgen cargo-audit cargo-outdated
44-
if ($LASTEXITCODE -ne 0) {
45-
throw "Rust tools installation failed with exit code $LASTEXITCODE"
42+
if (-not (Test-IsWin25)) {
43+
cargo install bindgen-cli cbindgen cargo-audit cargo-outdated
44+
if ($LASTEXITCODE -ne 0) {
45+
throw "Rust tools installation failed with exit code $LASTEXITCODE"
46+
}
47+
# Cleanup Cargo crates cache
48+
Remove-Item "${env:CARGO_HOME}\registry\*" -Recurse -Force
4649
}
4750

48-
# Cleanup Cargo crates cache
49-
Remove-Item "${env:CARGO_HOME}\registry\*" -Recurse -Force
50-
5151
Invoke-PesterTests -TestFile "Rust"

images/windows/scripts/build/Install-VisualStudio.ps1

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,18 @@ if (Test-IsWin19) {
3939
Install-Binary -Type EXE `
4040
-Url 'https://go.microsoft.com/fwlink/p/?linkid=2196241' `
4141
-InstallArgs @("/q", "/norestart", "/ceip off", "/features OptionId.UWPManaged OptionId.UWPCPP OptionId.UWPLocalized OptionId.DesktopCPPx86 OptionId.DesktopCPPx64 OptionId.DesktopCPParm64") `
42-
-ExpectedSignature 'E4C5C5FCDB68B930EE4E19BC25D431EF6D864C51'
42+
-ExpectedSignature 'E4C5C5FCDB68B930EE4E19BC25D431EF6D864C51'
4343
}
4444

45-
if (Test-IsWin22) {
45+
if (Test-IsWin22) {
4646
# Install Windows 10 SDK version 10.0.17763
4747
Install-Binary -Type EXE `
48-
-Url 'https://go.microsoft.com/fwlink/p/?LinkID=2033908' `
49-
-InstallArgs @("/q", "/norestart", "/ceip off", "/features OptionId.UWPManaged OptionId.UWPCPP OptionId.UWPLocalized OptionId.DesktopCPPx86 OptionId.DesktopCPPx64 OptionId.DesktopCPParm64") `
50-
-ExpectedSignature '7535269B94C1FEA4A5EF6D808E371DA242F27936'
48+
-Url 'https://go.microsoft.com/fwlink/p/?LinkID=2033908' `
49+
-InstallArgs @("/q", "/norestart", "/ceip off", "/features OptionId.UWPManaged OptionId.UWPCPP OptionId.UWPLocalized OptionId.DesktopCPPx86 OptionId.DesktopCPPx64 OptionId.DesktopCPParm64") `
50+
-ExpectedSignature '7535269B94C1FEA4A5EF6D808E371DA242F27936'
51+
}
52+
53+
if (-not (Test-IsWin19)) {
5154
# Install Windows 11 SDK version 10.0.26100
5255
Install-Binary -Type EXE `
5356
-Url 'https://go.microsoft.com/fwlink/?linkid=2286561' `

images/windows/scripts/build/Invoke-Cleanup.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,24 @@ cmd /c "npm cache clean --force 2>&1" | Out-Null
4949
if ($LASTEXITCODE -ne 0) {
5050
throw "Failed to clean npm cache"
5151
}
52+
53+
if (Test-IsWin25) {
54+
$directoriesToCompact = @(
55+
'C:\Windows\assembly',
56+
'C:\Windows\WinSxS'
57+
)
58+
Write-Host "Starting Image slimming process"
59+
$start = get-date
60+
$ErrorActionPreviousValue = $ErrorActionPreference
61+
$ErrorActionPreference = 'SilentlyContinue'
62+
Write-Host "Removing 'C:\Windows\Installer' directory"
63+
Remove-Item "$env:windir\Installer" -Recurse -Force | Out-Null
64+
foreach ($directory in $directoriesToCompact) {
65+
Write-Host "Compressing '$directory' directory"
66+
& compact /s:"$directory" /c /a /i /EXE:LZX * | Out-Null
67+
}
68+
$ErrorActionPreference = $ErrorActionPreviousValue
69+
$finish = get-date
70+
$time = "$(($finish - $start).Minutes):$(($finish - $start).Seconds)"
71+
Write-Host "The process took a total of $time (in minutes:seconds)"
72+
}

images/windows/scripts/docs-gen/Generate-SoftwareReport.ps1

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,22 @@ if (Test-IsWin19) {
8080
$tools.AddToolVersion("Google Cloud CLI", $(Get-GoogleCloudCLIVersion))
8181
}
8282
$tools.AddToolVersion("ImageMagick", $(Get-ImageMagickVersion))
83-
$tools.AddToolVersion("InnoSetup", $(Get-InnoSetupVersion))
83+
if (-not (Test-IsWin25)) {
84+
$tools.AddToolVersion("InnoSetup", $(Get-InnoSetupVersion))
85+
}
8486
$tools.AddToolVersion("jq", $(Get-JQVersion))
8587
$tools.AddToolVersion("Kind", $(Get-KindVersion))
8688
$tools.AddToolVersion("Kubectl", $(Get-KubectlVersion))
87-
$tools.AddToolVersion("Mercurial", $(Get-MercurialVersion))
89+
if (-not (Test-IsWin25)) {
90+
$tools.AddToolVersion("Mercurial", $(Get-MercurialVersion))
91+
}
8892
$tools.AddToolVersion("gcc", $(Get-GCCVersion))
8993
$tools.AddToolVersion("gdb", $(Get-GDBVersion))
9094
$tools.AddToolVersion("GNU Binutils", $(Get-GNUBinutilsVersion))
9195
$tools.AddToolVersion("Newman", $(Get-NewmanVersion))
92-
$tools.AddToolVersion("NSIS", $(Get-NSISVersion))
96+
if (-not (Test-IsWin25)) {
97+
$tools.AddToolVersion("NSIS", $(Get-NSISVersion))
98+
}
9399
$tools.AddToolVersion("OpenSSL", $(Get-OpenSSLVersion))
94100
$tools.AddToolVersion("Packer", $(Get-PackerVersion))
95101
if (Test-IsWin19) {
@@ -99,7 +105,9 @@ $tools.AddToolVersion("Pulumi", $(Get-PulumiVersion))
99105
$tools.AddToolVersion("R", $(Get-RVersion))
100106
$tools.AddToolVersion("Service Fabric SDK", $(Get-ServiceFabricSDKVersion))
101107
$tools.AddToolVersion("Stack", $(Get-StackVersion))
102-
$tools.AddToolVersion("Subversion (SVN)", $(Get-SVNVersion))
108+
if (-not (Test-IsWin25)) {
109+
$tools.AddToolVersion("Subversion (SVN)", $(Get-SVNVersion))
110+
}
103111
$tools.AddToolVersion("Swig", $(Get-SwigVersion))
104112
$tools.AddToolVersion("VSWhere", $(Get-VSWhereVersion))
105113
$tools.AddToolVersion("WinAppDriver", $(Get-WinAppDriver))
@@ -109,7 +117,9 @@ $tools.AddToolVersion("zstd", $(Get-ZstdVersion))
109117

110118
# CLI Tools
111119
$cliTools = $installedSoftware.AddHeader("CLI Tools")
112-
$cliTools.AddToolVersion("Alibaba Cloud CLI", $(Get-AlibabaCLIVersion))
120+
if (-not (Test-IsWin25)) {
121+
$cliTools.AddToolVersion("Alibaba Cloud CLI", $(Get-AlibabaCLIVersion))
122+
}
113123
$cliTools.AddToolVersion("AWS CLI", $(Get-AWSCLIVersion))
114124
$cliTools.AddToolVersion("AWS SAM CLI", $(Get-AWSSAMVersion))
115125
$cliTools.AddToolVersion("AWS Session Manager CLI", $(Get-AWSSessionManagerVersion))
@@ -129,10 +139,12 @@ $rustTools.AddToolVersion("Rustdoc", $(Get-RustdocVersion))
129139
$rustTools.AddToolVersion("Rustup", $(Get-RustupVersion))
130140

131141
$rustToolsPackages = $rustTools.AddHeader("Packages")
132-
$rustToolsPackages.AddToolVersion("bindgen", $(Get-BindgenVersion))
133-
$rustToolsPackages.AddToolVersion("cargo-audit", $(Get-CargoAuditVersion))
134-
$rustToolsPackages.AddToolVersion("cargo-outdated", $(Get-CargoOutdatedVersion))
135-
$rustToolsPackages.AddToolVersion("cbindgen", $(Get-CbindgenVersion))
142+
if (-not (Test-IsWin25)) {
143+
$rustToolsPackages.AddToolVersion("bindgen", $(Get-BindgenVersion))
144+
$rustToolsPackages.AddToolVersion("cargo-audit", $(Get-CargoAuditVersion))
145+
$rustToolsPackages.AddToolVersion("cargo-outdated", $(Get-CargoOutdatedVersion))
146+
$rustToolsPackages.AddToolVersion("cbindgen", $(Get-CbindgenVersion))
147+
}
136148
$rustToolsPackages.AddToolVersion("Clippy", $(Get-RustClippyVersion))
137149
$rustToolsPackages.AddToolVersion("Rustfmt", $(Get-RustfmtVersion))
138150

@@ -179,6 +191,9 @@ $databaseTools.AddToolVersion("DacFx", $(Get-DacFxVersion))
179191
$databaseTools.AddToolVersion("MySQL", $(Get-MySQLVersion))
180192
$databaseTools.AddToolVersion("SQL OLEDB Driver", $(Get-SQLOLEDBDriverVersion))
181193
$databaseTools.AddToolVersion("SQLPS", $(Get-SQLPSVersion))
194+
if (Test-IsWin25) {
195+
$databaseTools.AddToolVersion("MongoDB Shell (mongosh)", $(Get-MongoshVersion))
196+
}
182197

183198
# Web Servers
184199
$installedSoftware.AddHeader("Web Servers").AddTable($(Build-WebServersSection))
@@ -222,7 +237,9 @@ Azure PowerShell module 2.1.0 and AzureRM PowerShell module 2.1.0 are installed
222237
and are available via 'Get-Module -ListAvailable'.
223238
All other versions are saved but not installed.
224239
'@
225-
$psModules.AddNote($azPsNotes)
240+
if (-not (Test-IsWin25)) {
241+
$psModules.AddNote($azPsNotes)
242+
}
226243

227244
# Android
228245
$android = $installedSoftware.AddHeader("Android")
@@ -231,7 +248,9 @@ $android.AddTable($(Build-AndroidTable))
231248
$android.AddHeader("Environment variables").AddTable($(Build-AndroidEnvironmentTable))
232249

233250
# Cached Docker images
234-
$installedSoftware.AddHeader("Cached Docker images").AddTable($(Get-CachedDockerImagesTableData))
251+
if (-not (Test-IsWin25)) {
252+
$installedSoftware.AddHeader("Cached Docker images").AddTable($(Get-CachedDockerImagesTableData))
253+
}
235254

236255
# Generate reports
237256
$softwareReport.ToJson() | Out-File -FilePath "C:\software-report.json" -Encoding UTF8NoBOM

0 commit comments

Comments
 (0)