Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
107a8cc
Add win11-arm template and toolset
shamil-mubarakshin Mar 16, 2026
4b60db6
Update Install Helpers
shamil-mubarakshin Mar 16, 2026
81627de
Modify codebase to support Arm
shamil-mubarakshin Mar 18, 2026
20afed4
Fix source_image_marketplace_sku
shamil-mubarakshin Mar 18, 2026
d9157b4
DEBUG: elevated packer, add SeBatchLogonRight
shamil-mubarakshin Mar 19, 2026
c0d2ad3
DEBUG:V2 elevated packer, add SeBatchLogonRight
shamil-mubarakshin Mar 19, 2026
12bdc44
DEBUG:V3 elevated packer, test auto logon
shamil-mubarakshin Mar 20, 2026
614b8c5
DEBUG:V3 elevated packer, test auto logon with reboot
shamil-mubarakshin Mar 20, 2026
a0d26c5
Remove Install-ServiceFabricSDK.ps1
shamil-mubarakshin Mar 20, 2026
1d8b7e6
Fix Install-Rust.ps1
shamil-mubarakshin Mar 20, 2026
23dd906
TEMP: remove cargo-audit
shamil-mubarakshin Mar 21, 2026
ca62df3
Fix Install-Firefox.ps1 asset names
shamil-mubarakshin Mar 21, 2026
b809ada
Patch web browser scripts
shamil-mubarakshin Mar 22, 2026
5acc332
Fix pester tests
shamil-mubarakshin Mar 22, 2026
c7fea09
Fix Install-Ruby.ps1
shamil-mubarakshin Mar 22, 2026
45f33fa
Fix Haskell.Tests.ps1
shamil-mubarakshin Mar 22, 2026
4407a2e
DEBUG: output windows updates state
shamil-mubarakshin Mar 23, 2026
c94f45a
Skip MicrosoftWindows.Client.WebExperience update fails
shamil-mubarakshin Mar 23, 2026
29ae1b4
Fix Build-PackageManagementEnvironmentTable
shamil-mubarakshin Mar 24, 2026
52a499f
Revert "TEMP: remove cargo-audit"
shamil-mubarakshin Mar 24, 2026
eaf680b
Cleanup code
shamil-mubarakshin Mar 24, 2026
fb1b0dd
Fix LLVM install sequence
shamil-mubarakshin Mar 24, 2026
c88da39
Add win11-vs2026-arm64 code
shamil-mubarakshin Mar 24, 2026
952ac23
remove vs workloads
shamil-mubarakshin Mar 24, 2026
bb7bd55
Add win11-arm template and toolset
shamil-mubarakshin Mar 16, 2026
65410c8
Update Install Helpers
shamil-mubarakshin Mar 16, 2026
045b85c
Modify codebase to support Arm
shamil-mubarakshin Mar 18, 2026
46988f3
Fix source_image_marketplace_sku
shamil-mubarakshin Mar 18, 2026
649e7dc
DEBUG: elevated packer, add SeBatchLogonRight
shamil-mubarakshin Mar 19, 2026
84ef25f
DEBUG:V2 elevated packer, add SeBatchLogonRight
shamil-mubarakshin Mar 19, 2026
aff033d
DEBUG:V3 elevated packer, test auto logon
shamil-mubarakshin Mar 20, 2026
056c081
DEBUG:V3 elevated packer, test auto logon with reboot
shamil-mubarakshin Mar 20, 2026
fc73540
Remove Install-ServiceFabricSDK.ps1
shamil-mubarakshin Mar 20, 2026
55b3795
Fix Install-Rust.ps1
shamil-mubarakshin Mar 20, 2026
a464377
TEMP: remove cargo-audit
shamil-mubarakshin Mar 21, 2026
811ac68
Fix Install-Firefox.ps1 asset names
shamil-mubarakshin Mar 21, 2026
ec19008
Patch web browser scripts
shamil-mubarakshin Mar 22, 2026
eb9ce8b
Fix pester tests
shamil-mubarakshin Mar 22, 2026
b5c33c4
Fix Install-Ruby.ps1
shamil-mubarakshin Mar 22, 2026
6d309df
Fix Haskell.Tests.ps1
shamil-mubarakshin Mar 22, 2026
3ce8ab8
DEBUG: output windows updates state
shamil-mubarakshin Mar 23, 2026
1d04e42
Skip MicrosoftWindows.Client.WebExperience update fails
shamil-mubarakshin Mar 23, 2026
1ce128c
Fix Build-PackageManagementEnvironmentTable
shamil-mubarakshin Mar 24, 2026
e9bec78
Revert "TEMP: remove cargo-audit"
shamil-mubarakshin Mar 24, 2026
18fec92
Cleanup code
shamil-mubarakshin Mar 24, 2026
9c0fdaa
Fix LLVM install sequence
shamil-mubarakshin Mar 24, 2026
f422691
Add win11-vs2026-arm64 code
shamil-mubarakshin Mar 24, 2026
1613b62
remove vs workloads
shamil-mubarakshin Mar 24, 2026
aaa3859
Fix BaseImage and ImageDataFile scripts
shamil-mubarakshin Apr 2, 2026
1ce4c20
Merge branch 'shamilm/add-win11-arm-vs2026' of github.com:shamil-muba…
shamil-mubarakshin Apr 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion images/windows/scripts/build/Configure-BaseImage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function Disable-WindowsUpdate {
Add-Content -Path $profile.AllUsersAllHosts -Value '$ErrorActionPreference="Stop"'

Write-Host "Disable Server Manager on Logon"
Get-ScheduledTask -TaskName ServerManager | Disable-ScheduledTask
Get-ScheduledTask -TaskName ServerManager -ErrorAction SilentlyContinue | Disable-ScheduledTask
Copy link
Copy Markdown
Contributor

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-IsArm64 instead of silentlyContinue to avoid problems.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remote Access Management Tools optional feature is not enabled on windows-11


Write-Host "Disable 'Allow your PC to be discoverable by other PCs' popup"
New-Item -Path HKLM:\System\CurrentControlSet\Control\Network -Name NewNetworkWindowOff -Force
Expand Down
10 changes: 9 additions & 1 deletion images/windows/scripts/build/Configure-ImageDataFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider changing helpers to include architecture:

  • rename Test-IsWin25 to Test-IsWin25-X64
  • rename Test-IsWin22 to Test-IsWin22-X64
  • rename Test-IsWin11 to Test-IsWin11-Arm64
  • add helper Test-IsX64

$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 = @"
Expand Down
4 changes: 3 additions & 1 deletion images/windows/scripts/build/Configure-Shell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be -not (Test-IsArm64) or Test-IsX64

# add a wrapper for C:\msys64\usr\bin\bash.exe
@'
@echo off
setlocal
Expand All @@ -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
Expand Down
8 changes: 7 additions & 1 deletion images/windows/scripts/build/Configure-Toolset.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
## Desc: Configure Toolset
################################################################################

if ( Test-IsArm64 ) {
$envVarTemplate = "GOROOT_{0}_{1}_AARCH64"
} else {
$envVarTemplate = "GOROOT_{0}_{1}_X64"
}

$toolEnvConfigs = @{
Python = @{
pathTemplates = @(
Expand All @@ -15,7 +21,7 @@ $toolEnvConfigs = @{
pathTemplates = @(
"{0}\bin"
)
envVarTemplate = "GOROOT_{0}_{1}_X64"
envVarTemplate = $envVarTemplate
}
}

Expand Down
4 changes: 2 additions & 2 deletions images/windows/scripts/build/Configure-User.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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
if (-not (Test-IsWin25) -and -not (Test-IsWin11)) {
if (Test-IsWin22) {

# disable TSVNCache.exe
$registryKeyPath = 'HKCU:\Software\TortoiseSVN'
if (-not(Test-Path -Path $registryKeyPath)) {
Expand Down
10 changes: 8 additions & 2 deletions images/windows/scripts/build/Install-Apache.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
################################################################################

# Stop w3svc service
Stop-Service -Name w3svc
$w3svcService = Get-Service -Name "w3svc" -ErrorAction SilentlyContinue
if ($w3svcService) {
Stop-Service $w3svcService
}

# Install latest apache in chocolatey
$installDir = "C:\tools"
Expand All @@ -15,7 +18,10 @@ Stop-Service -Name Apache
Set-Service -Name Apache -StartupType Disabled

# Start w3svc service
Start-Service -Name w3svc
$w3svcService = Get-Service -Name "w3svc" -ErrorAction SilentlyContinue
if ($w3svcService) {
Start-Service $w3svcService
}

# Invoke Pester Tests
Invoke-PesterTests -TestFile "Apache"
35 changes: 35 additions & 0 deletions images/windows/scripts/build/Install-CMake.ps1
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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"
8 changes: 7 additions & 1 deletion images/windows/scripts/build/Install-Chrome.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
## Desc: Install Google Chrome browser and Chrome WebDriver
################################################################################

if (Test-IsArm64) {
$browserDownloadUrl = "https://dl.google.com/tag/s/dl/chrome/install/googlechromestandaloneenterprise_arm64.msi"
} else {
$browserDownloadUrl = "https://dl.google.com/tag/s/dl/chrome/install/googlechromestandaloneenterprise64.msi"
}

# Download and install latest Chrome browser
Install-Binary `
-Url 'https://dl.google.com/tag/s/dl/chrome/install/googlechromestandaloneenterprise64.msi' `
-Url $browserDownloadUrl `
-ExpectedSubject 'CN=Google LLC, O=Google LLC, L=Mountain View, S=California, C=US, SERIALNUMBER=3582691, OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.2=Delaware, OID.1.3.6.1.4.1.311.60.2.1.3=US'

# Prepare firewall rules
Expand Down
25 changes: 13 additions & 12 deletions images/windows/scripts/build/Install-DotnetSDK.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "expected" sounds mis-leading here.

Suggested change
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
if (Test-IsArm64) {
$dotnetArch = "arm64"
} else {
$dotnetArch = "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-$dotnetArch.zip" }).hash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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
}
Expand All @@ -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
Expand All @@ -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
}
}

Expand Down
8 changes: 7 additions & 1 deletion images/windows/scripts/build/Install-EdgeDriver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
## Desc: Install Edge WebDriver and configure Microsoft Edge
################################################################################

if (Test-IsArm64) {
$expectedArch = "arm64"
} else {
$expectedArch = "win64"
}

# Disable Edge auto-updates
Rename-Item -Path "C:\Program Files (x86)\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe" -NewName "Disabled_MicrosoftEdgeUpdate.exe" -ErrorAction Stop

Expand All @@ -20,7 +26,7 @@ $versionInfoFile = Invoke-DownloadWithRetry -Url $versionInfoUrl -Path "$edgeDri
$latestVersion = Get-Content -Path $versionInfoFile

Write-Host "Download Microsoft Edge WebDriver..."
$downloadUrl = "https://msedgedriver.microsoft.com/$latestVersion/edgedriver_win64.zip"
$downloadUrl = "https://msedgedriver.microsoft.com/$latestVersion/edgedriver_$expectedArch.zip"
$archivePath = Invoke-DownloadWithRetry $downloadUrl

Write-Host "Expand Microsoft Edge WebDriver archive..."
Expand Down
14 changes: 11 additions & 3 deletions images/windows/scripts/build/Install-Firefox.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nits:

  • expectedArch -> browserArch
  • driverSufix -> driverSuffix

} 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 `
Expand Down Expand Up @@ -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..."
Expand Down
9 changes: 7 additions & 2 deletions images/windows/scripts/build/Install-Git.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
## Supply chain security: Git - checksum validation, Hub CLI - managed by package manager
################################################################################

# Install the latest version of Git for Windows
if (Test-IsArm64) {
$expectedArch = "arm64"
} else {
$expectedArch = "64-bit"
}

# Install the latest version of Git for Windows
$downloadUrl = Resolve-GithubReleaseAssetUrl `
-Repo "git-for-windows/git" `
-Version "latest" `
-UrlMatchPattern "Git-*-64-bit.exe"
-UrlMatchPattern "Git-*-$expectedArch.exe"

$externalHash = Get-ChecksumFromGithubRelease `
-Repo "git-for-windows/git" `
Expand Down
9 changes: 7 additions & 2 deletions images/windows/scripts/build/Install-GitHub-CLI.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
## Supply chain security: GitHub CLI - checksum validation
################################################################################

Write-Host "Get the latest gh version..."
if (Test-IsArm64) {
$expectedArch = "arm64"
} else {
$expectedArch = "amd64"
}

Write-Host "Get the latest gh version..."
$downloadUrl = Resolve-GithubReleaseAssetUrl `
-Repo "cli/cli" `
-Version "latest" `
-UrlMatchPattern "gh_*_windows_amd64.msi"
-UrlMatchPattern "gh_*_windows_$expectedArch.msi"

$checksumsUrl = Resolve-GithubReleaseAssetUrl `
-Repo "cli/cli" `
Expand Down
16 changes: 11 additions & 5 deletions images/windows/scripts/build/Install-JavaTools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ function Set-JavaPath {
exit 1
}

Write-Host "Set 'JAVA_HOME_${Version}_X64' environmental variable as $javaPath"
[Environment]::SetEnvironmentVariable("JAVA_HOME_${Version}_X64", $javaPath, "Machine")
Write-Host "Set 'JAVA_HOME_${Version}_$($Architecture.ToUpper())' environmental variable as $javaPath"
[Environment]::SetEnvironmentVariable("JAVA_HOME_${Version}_$($Architecture.ToUpper())", $javaPath, "Machine")

if ($Default) {
# Clean up any other Java folders from PATH to make sure that they won't conflict with each other
Expand Down Expand Up @@ -91,19 +91,25 @@ function Install-JavaJDK {
New-Item -ItemType File -Path $javaVersionPath -Name "$Architecture.complete" | Out-Null
}

if (Test-IsArm64) {
$expectedArch = "aarch64"
} else {
$expectedArch = "x64"
}

$toolsetJava = (Get-ToolsetContent).java
$defaultVersion = $toolsetJava.default
$jdkVersionsToInstall = $toolsetJava.versions

foreach ($jdkVersionToInstall in $jdkVersionsToInstall) {
$isDefaultVersion = $jdkVersionToInstall -eq $defaultVersion

Install-JavaJDK -JDKVersion $jdkVersionToInstall
Install-JavaJDK -JDKVersion $jdkVersionToInstall -Architecture $expectedArch

if ($isDefaultVersion) {
Set-JavaPath -Version $jdkVersionToInstall -Default
Set-JavaPath -Version $jdkVersionToInstall -Architecture $expectedArch -Default
} else {
Set-JavaPath -Version $jdkVersionToInstall
Set-JavaPath -Version $jdkVersionToInstall -Architecture $expectedArch
}
}

Expand Down
32 changes: 29 additions & 3 deletions images/windows/scripts/build/Install-LLVM.ps1
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"
Loading
Loading