-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[windows] Add windows-11-arm64 image generation code #13879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
107a8cc
4b60db6
81627de
20afed4
d9157b4
c0d2ad3
12bdc44
614b8c5
a0d26c5
1d8b7e6
23dd906
ca62df3
b809ada
5acc332
c7fea09
45f33fa
4407a2e
c94f45a
29ae1b4
52a499f
eaf680b
fb1b0dd
c88da39
952ac23
bb7bd55
65410c8
045b85c
46988f3
649e7dc
84ef25f
aff033d
056c081
fc73540
55b3795
a464377
811ac68
ec19008
eb9ce8b
b5c33c4
6d309df
3ce8ab8
1d04e42
1ce128c
e9bec78
18fec92
9c0fdaa
f422691
1613b62
aaa3859
1ce4c20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,8 +27,16 @@ if ((Test-IsWin25) -and $env:INSTALL_VS_2026) { | |
| $imageLabel = "windows-2022" | ||
| $softwareUrl = "${githubUrl}/win22/$imageMajorVersion.$imageMinorVersion/images/windows/Windows2022-Readme.md" | ||
| $releaseUrl = "https://github.com/actions/runner-images/releases/tag/win22%2F$imageMajorVersion.$imageMinorVersion" | ||
| } elseif ((Test-IsWin11) -and (Test-IsArm64) -and $env:INSTALL_VS_2026) { | ||
| $imageLabel = "windows-11-vs2026-arm64" | ||
| $softwareUrl = "${githubUrl}/win11-vs2026-arm64/$imageMajorVersion.$imageMinorVersion/images/windows/Windows11-VS2026-Arm64-Readme.md" | ||
| $releaseUrl = "https://github.com/actions/runner-images/releases/tag/win11-vs2026-arm64%2F$imageMajorVersion.$imageMinorVersion" | ||
| } elseif ((Test-IsWin11) -and (Test-IsArm64)) { | ||
|
Comment on lines
+30
to
+34
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider changing helpers to include architecture:
|
||
| $imageLabel = "windows-11-arm64" | ||
| $softwareUrl = "${githubUrl}/win11-arm64/$imageMajorVersion.$imageMinorVersion/images/windows/Windows11-Arm64-Readme.md" | ||
| $releaseUrl = "https://github.com/actions/runner-images/releases/tag/win11-arm64%2F$imageMajorVersion.$imageMinorVersion" | ||
| } else { | ||
| throw "Invalid platform version is found. Either Windows Server 2022 or 2025 are required" | ||
| throw "Invalid platform version is found. Either Windows Server 2022, 2025 or Windows 11 are required" | ||
| } | ||
|
|
||
| $json = @" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,8 @@ | |
| $shellPath = "C:\shells" | ||
| New-Item -Path $shellPath -ItemType Directory | Out-Null | ||
|
|
||
| # add a wrapper for C:\msys64\usr\bin\bash.exe | ||
| if (-not (Test-IsWin11)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it should be |
||
| # add a wrapper for C:\msys64\usr\bin\bash.exe | ||
| @' | ||
| @echo off | ||
| setlocal | ||
|
|
@@ -11,6 +12,7 @@ IF NOT DEFINED MSYSTEM set MSYSTEM=mingw64 | |
| set CHERE_INVOKING=1 | ||
| C:\msys64\usr\bin\bash.exe -leo pipefail %* | ||
| '@ | Out-File -FilePath "$shellPath\msys2bash.cmd" -Encoding ascii | ||
| } | ||
|
|
||
| # gitbash <--> C:\Program Files\Git\bin\bash.exe | ||
| New-Item -ItemType SymbolicLink -Path "$shellPath\gitbash.exe" -Target "$env:ProgramFiles\Git\bin\bash.exe" | Out-Null | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -27,8 +27,8 @@ if ($LASTEXITCODE -ne 0) { | |||||
| throw "Failed to copy HKCU\Software\Microsoft\VisualStudio to HKLM\DEFAULT\Software\Microsoft\VisualStudio" | ||||||
| } | ||||||
|
|
||||||
| # TortoiseSVN not installed on Windows 2025 image due to Sysprep issues | ||||||
| if (-not (Test-IsWin25)) { | ||||||
| # TortoiseSVN not installed on Windows 2025 and Windows 11 due to Sysprep issues | ||||||
| if (-not (Test-IsWin25) -and -not (Test-IsWin11)) { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to avoid extending this condition every time when add a new image
Suggested change
|
||||||
| # disable TSVNCache.exe | ||||||
| $registryKeyPath = 'HKCU:\Software\TortoiseSVN' | ||||||
| if (-not(Test-Path -Path $registryKeyPath)) { | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| ################################################################################ | ||
| ## File: Install-CMake.ps1 | ||
| ## Desc: Install CMake (ARM64 only; x64 is installed via Choco) | ||
| ## Supply chain security: CMake - checksum validation | ||
| ################################################################################ | ||
|
|
||
| if (-not (Test-IsArm64)) { | ||
| exit 0 | ||
| } | ||
|
Comment on lines
+7
to
+9
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we just not add it to x64 template? If we keep it as it is, it could be very confusing. packer logs will show that script is completed. |
||
|
|
||
| # Install CMake | ||
| $downloadUrl = Resolve-GithubReleaseAssetUrl ` | ||
| -Repo "Kitware/CMake" ` | ||
| -Version "latest" ` | ||
| -UrlMatchPattern "cmake-*-windows-arm64.msi" | ||
|
|
||
| #region Supply chain security - CMake | ||
| $packageName = Split-Path $downloadUrl -Leaf | ||
| $checksumsUrl = Resolve-GithubReleaseAssetUrl ` | ||
| -Repo "Kitware/CMake" ` | ||
| -Version "latest" ` | ||
| -UrlMatchPattern "cmake-*-SHA-256.txt" | ||
| $externalHash = Get-ChecksumFromUrl -Type "SHA256" ` | ||
| -Url $checksumsUrl ` | ||
| -FileName $packageName | ||
| #endregion | ||
|
|
||
| Install-Binary ` | ||
| -Url $downloadUrl ` | ||
| -ExtraInstallArgs @("ADD_CMAKE_TO_PATH=System") ` | ||
| -ExpectedSHA256Sum $externalHash | ||
|
|
||
| Update-Environment | ||
|
|
||
| Invoke-PesterTests -TestFile "Tools" -TestName "CMake" | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -82,9 +82,14 @@ function Install-DotnetSDK { | |||||||||||||||||||||||||||||||||||
| # If installation failed, tests will fail anyway | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| #region Supply chain security | ||||||||||||||||||||||||||||||||||||
| if (Test-IsArm64) { | ||||||||||||||||||||||||||||||||||||
| $expectedArch = "arm64" | ||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||
| $expectedArch = "x64" | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| $releasesJsonUri = "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/${DotnetVersion}/releases.json" | ||||||||||||||||||||||||||||||||||||
| $releasesData = (Invoke-DownloadWithRetry $releasesJsonUri) | Get-Item | Get-Content | ConvertFrom-Json | ||||||||||||||||||||||||||||||||||||
| $distributorFileHash = $releasesData.releases.sdks.Where({ $_.version -eq $SDKVersion }).files.Where({ $_.name -eq 'dotnet-sdk-win-x64.zip' }).hash | ||||||||||||||||||||||||||||||||||||
| $distributorFileHash = $releasesData.releases.sdks.Where({ $_.version -eq $SDKVersion }).files.Where({ $_.name -eq "dotnet-sdk-win-$expectedArch.zip" }).hash | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+85
to
+92
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: "expected" sounds mis-leading here.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the same for a bunch of other scripts. |
||||||||||||||||||||||||||||||||||||
| Test-FileChecksum $zipPath -ExpectedSHA512Sum $distributorFileHash | ||||||||||||||||||||||||||||||||||||
| #endregion | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
@@ -97,11 +102,9 @@ $installScriptPath = Invoke-DownloadWithRetry -Url "https://dot.net/v1/dotnet-in | |||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # Visual Studio 2022 pre-creates sdk-manifests/8.0.100 folder, causing dotnet-install to skip manifests creation | ||||||||||||||||||||||||||||||||||||
| # https://github.com/actions/runner-images/issues/11402 | ||||||||||||||||||||||||||||||||||||
| if ((Test-IsWin22) -or (Test-IsWin25)) { | ||||||||||||||||||||||||||||||||||||
| $sdkManifestPath = "C:\Program Files\dotnet\sdk-manifests\8.0.100" | ||||||||||||||||||||||||||||||||||||
| if (Test-Path $sdkManifestPath) { | ||||||||||||||||||||||||||||||||||||
| Move-Item -Path $sdkManifestPath -Destination $env:TEMP_DIR -ErrorAction Stop | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| $sdkManifestPath = "C:\Program Files\dotnet\sdk-manifests\8.0.100" | ||||||||||||||||||||||||||||||||||||
| if (Test-Path $sdkManifestPath) { | ||||||||||||||||||||||||||||||||||||
| Move-Item -Path $sdkManifestPath -Destination $env:TEMP_DIR -ErrorAction Stop | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # Install and warm up dotnet | ||||||||||||||||||||||||||||||||||||
|
|
@@ -122,12 +125,10 @@ foreach ($dotnetVersion in $dotnetToolset.versions) { | |||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # Replace manifests inside sdk-manifests/8.0.100 folder with ones from Visual Studio | ||||||||||||||||||||||||||||||||||||
| # https://github.com/actions/runner-images/issues/11402 | ||||||||||||||||||||||||||||||||||||
| if ((Test-IsWin22) -or (Test-IsWin25)) { | ||||||||||||||||||||||||||||||||||||
| if (Test-Path "${env:TEMP_DIR}\8.0.100") { | ||||||||||||||||||||||||||||||||||||
| Get-ChildItem -Path "${env:TEMP_DIR}\8.0.100" | ForEach-Object { | ||||||||||||||||||||||||||||||||||||
| Remove-Item -Path "$sdkManifestPath\$($_.BaseName)" -Recurse -Force | Out-Null | ||||||||||||||||||||||||||||||||||||
| Move-Item -Path $_.FullName -Destination $sdkManifestPath -Force -ErrorAction Stop | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| if (Test-Path "${env:TEMP_DIR}\8.0.100") { | ||||||||||||||||||||||||||||||||||||
| Get-ChildItem -Path "${env:TEMP_DIR}\8.0.100" | ForEach-Object { | ||||||||||||||||||||||||||||||||||||
| Remove-Item -Path "$sdkManifestPath\$($_.BaseName)" -Recurse -Force | Out-Null | ||||||||||||||||||||||||||||||||||||
| Move-Item -Path $_.FullName -Destination $sdkManifestPath -Force -ErrorAction Stop | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,17 +4,25 @@ | |
| ## Supply chain security: Firefox browser - checksum validation | ||
| ################################################################################ | ||
|
|
||
| if (Test-IsArm64) { | ||
| $expectedArch = "win64-aarch64" | ||
| $driverSufix = "win-aarch64" | ||
|
Comment on lines
+8
to
+9
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nits:
|
||
| } else { | ||
| $expectedArch = "win64" | ||
| $driverSufix = "win64" | ||
| } | ||
|
|
||
| # Install and configure Firefox browser | ||
| Write-Host "Get the latest Firefox version..." | ||
| $versionsManifest = Invoke-RestMethod "https://product-details.mozilla.org/1.0/firefox_versions.json" | ||
|
|
||
| Write-Host "Install Firefox browser..." | ||
| $installerUrl = "https://download.mozilla.org/?product=firefox-$($versionsManifest.LATEST_FIREFOX_VERSION)&os=win64&lang=en-US" | ||
| $installerUrl = "https://download.mozilla.org/?product=firefox-$($versionsManifest.LATEST_FIREFOX_VERSION)&os=$expectedArch&lang=en-US" | ||
| $hashUrl = "https://archive.mozilla.org/pub/firefox/releases/$($versionsManifest.LATEST_FIREFOX_VERSION)/SHA256SUMS" | ||
|
|
||
| $externalHash = Get-ChecksumFromUrl -Type "SHA256" ` | ||
| -Url $hashUrl ` | ||
| -FileName "win64/en-US/Firefox Setup*exe" | ||
| -FileName "$expectedArch/en-US/Firefox Setup*exe" | ||
|
|
||
| Install-Binary -Type EXE ` | ||
| -Url $installerUrl ` | ||
|
|
@@ -46,7 +54,7 @@ Write-Host "Download Gecko WebDriver WebDriver..." | |
| $geckoDriverDownloadUrl = Resolve-GithubReleaseAssetUrl ` | ||
| -Repo "mozilla/geckodriver" ` | ||
| -Version $geckoDriverVersion ` | ||
| -UrlMatchPattern "geckodriver-*-win64.zip" | ||
| -UrlMatchPattern "geckodriver-*-$driverSufix.zip" | ||
| $geckoDriverArchPath = Invoke-DownloadWithRetry $geckoDriverDownloadUrl | ||
|
|
||
| Write-Host "Expand Gecko WebDriver archive..." | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,36 @@ | ||
| ################################################################################ | ||
| ## File: Install-LLVM.ps1 | ||
| ## Desc: Install the latest stable version of llvm and clang compilers | ||
| ## Desc: Install the stable version of llvm and clang compilers | ||
| ################################################################################ | ||
|
|
||
| $llvmVersion = (Get-ToolsetContent).llvm.version | ||
| $latestChocoVersion = Resolve-ChocoPackageVersion -PackageName "llvm" -TargetVersion $llvmVersion | ||
| Install-ChocoPackage llvm -ArgumentList '--version', $latestChocoVersion | ||
|
|
||
| if (Test-IsArm64) { | ||
| $installDir = "C:\Program Files\LLVM" | ||
|
|
||
| Write-Host "Resolve LLVM $llvmVersion ARM64 download URL" | ||
| $downloadUrl = Resolve-GithubReleaseAssetUrl ` | ||
| -Repository "llvm/llvm-project" ` | ||
| -Version $llvmVersion ` | ||
| -UrlMatchPattern "clang*llvm-*-aarch64-pc-windows-msvc.tar.xz" | ||
|
|
||
| Write-Host "Download LLVM $llvmVersion ARM64 archive" | ||
| $archivePath = Invoke-DownloadWithRetry $downloadUrl | ||
|
|
||
| Write-Host "Extract LLVM archive" | ||
| $tarPath = $archivePath -replace '\.xz$' | ||
| Expand-7ZipArchive -Path $archivePath -DestinationPath (Split-Path $archivePath) | ||
| Expand-7ZipArchive -Path $tarPath -DestinationPath $env:TEMP_DIR | ||
|
|
||
| Write-Host "Install LLVM to $installDir" | ||
| $extractedDir = Get-ChildItem -Path $env:TEMP_DIR -Directory -Filter "clang+llvm-*" | Select-Object -First 1 | ||
| Move-Item -Path $extractedDir.FullName -Destination $installDir -Force | ||
|
|
||
| Add-MachinePathItem (Join-Path $installDir "bin") | ||
| Update-Environment | ||
| } else { | ||
| $latestChocoVersion = Resolve-ChocoPackageVersion -PackageName "llvm" -TargetVersion $llvmVersion | ||
| Install-ChocoPackage llvm -ArgumentList '--version', $latestChocoVersion | ||
| } | ||
|
|
||
| Invoke-PesterTests -TestFile "LLVM" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious why it is not required for arm64.
I wonder if we want to wrap it to
Test-IsArm64instead of silentlyContinue to avoid problems.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remote Access Management Toolsoptional feature is not enabled on windows-11