Skip to content

Commit

Permalink
feat: update Windows base images to 2024.04B (Azure#4268)
Browse files Browse the repository at this point in the history
Co-authored-by: ShiqianTao <[email protected]>
  • Loading branch information
AbelHu and ShiqianTao authored Apr 10, 2024
1 parent 8e1aff6 commit 793fff1
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 20 deletions.
59 changes: 59 additions & 0 deletions vhdbuilder/packer/configure-windows-vhd.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,10 @@ function Update-Registry {

Write-Log "Enable 1 fix in 2024-01B"
Enable-WindowsFixInFeatureManagement -Name 1102009996

Write-Log "Enable 2 fixes in 2024-04B"
Enable-WindowsFixInFeatureManagement -Name 2290715789
Enable-WindowsFixInFeatureManagement -Name 3152880268
}

if ($env:WindowsSKU -Like '2022*') {
Expand Down Expand Up @@ -638,6 +642,19 @@ function Update-Registry {
Enable-WindowsFixInFeatureManagement -Name 1114842764
Enable-WindowsFixInFeatureManagement -Name 4154935436
Enable-WindowsFixInFeatureManagement -Name 124082829

Write-Log "Enable 11 fixes in 2024-04B"
Enable-WindowsFixInFeatureManagement -Name 3744292492
Enable-WindowsFixInFeatureManagement -Name 3838270605
Enable-WindowsFixInFeatureManagement -Name 851795084
Enable-WindowsFixInFeatureManagement -Name 26691724
Enable-WindowsFixInFeatureManagement -Name 3834988172
Enable-WindowsFixInFeatureManagement -Name 1535854221
Enable-WindowsFixInFeatureManagement -Name 3632636556
Enable-WindowsFixInFeatureManagement -Name 1552261773
Enable-WindowsFixInFeatureManagement -Name 4186914956
Enable-WindowsFixInFeatureManagement -Name 3173070476
Enable-WindowsFixInFeatureManagement -Name 3958450316
}

if ($env:WindowsSKU -Like '23H2*') {
Expand All @@ -646,7 +663,49 @@ function Update-Registry {
}
}

function Clear-TempFolder {
$tempFolders = @()
$tempFolders += [System.Environment]::GetFolderPath('LocalApplicationData') + '\Temp'
$tempFolders += [System.Environment]::GetFolderPath('InternetCache')
$tempFolders += [System.Environment]::GetFolderPath('Windows') + '\Temp'

# Iterate over each temporary folder
foreach ($folder in $tempFolders) {
# Check if the folder exists
if (-not (Test-Path -Path $folder -PathType Container)) {
Write-Host "The folder '$folder' does not exist."
continue
}

# Get all files in the temporary folder
$tempFiles = Get-ChildItem -Path $folder -File -Force

# Delete each file in the temporary folder
foreach ($file in $tempFiles) {
# skip file if the file name contains "packer"
if ($file.Name -like "*packer*") {
continue
}

try {
Remove-Item -Path $file.FullName -Force
} catch {
Write-Host "Failed to remove file: $($file.FullName)"
continue
}
}

# Confirm completion for each folder
Write-Host "Temporary files in '$folder' cleaned up successfully."
}

# Give the system some time to release the file handles
Start-Sleep -Seconds 1
}


function Get-SystemDriveDiskInfo {
Clear-TempFolder
Write-Log "Get Disk info"
$disksInfo=Get-CimInstance -ClassName Win32_LogicalDisk
foreach($disk in $disksInfo) {
Expand Down
16 changes: 7 additions & 9 deletions vhdbuilder/packer/generate-windows-vhd-configuration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if ($windowsSKU -Like "23H2*") {
# Windows Server 2019 update history can be found at https://support.microsoft.com/en-us/help/4464619
# Windows Server 2022 update history can be found at https://support.microsoft.com/en-us/topic/windows-server-2022-update-history-e1caa597-00c5-4ab9-9f3e-8212fe80b2ee
# Windows Server 23H2 update history can be found at https://support.microsoft.com/en-us/topic/windows-server-version-23h2-update-history-68c851ff-825a-4dbc-857b-51c5aa0ab248
# then you can get download links by searching for specific KBs at http://www.catalog.update.microsoft.com/home.aspx
#
# IMPORTANT NOTES: Please check the KB article before getting the KB links. For example, for 2021-4C:
Expand All @@ -39,17 +40,17 @@ $global:defenderUpdateInfoUrl = "https://go.microsoft.com/fwlink/?linkid=870379&
switch -Regex ($windowsSku) {
"2019-containerd" {
$global:patchUrls = @("https://catalog.s.download.windowsupdate.com/c/msdownload/update/software/secu/2024/03/windows10.0-kb5035849-x64_eb960a140cd0ba04dd175df1b3268295295bfefa.msu")
$global:patchIDs = @("KB5035849")
$global:patchUrls = @("https://catalog.s.download.windowsupdate.com/d/msdownload/update/software/secu/2024/04/windows10.0-kb5036896-x64_57eaad3d6f3738831f3f8c6bdf7a77df618429c2.msu")
$global:patchIDs = @("KB5036896")
$global:imagesToPull = @(
"mcr.microsoft.com/windows/servercore:ltsc2019",
"mcr.microsoft.com/windows/nanoserver:1809"
)
}
"2022-containerd*" {
$global:patchUrls = @("https://catalog.s.download.windowsupdate.com/d/msdownload/update/software/secu/2024/03/windows10.0-kb5035857-x64_f699534e61e7e8e750a7f751f6a1ff4d03bd3ebb.msu")
$global:patchIDs = @("KB5035857")
$global:patchUrls = @("https://catalog.s.download.windowsupdate.com/c/msdownload/update/software/secu/2024/04/windows10.0-kb5036909-x64_786040b0b0d000b17d6a727ea93ff77d733d1044.msu")
$global:patchIDs = @("KB5036909")
$global:imagesToPull = @(
"mcr.microsoft.com/windows/servercore:ltsc2022",
Expand All @@ -60,8 +61,8 @@ switch -Regex ($windowsSku) {
)
}
"23H2*" {
$global:patchUrls = @()
$global:patchIDs = @()
$global:patchUrls = @("https://catalog.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/b76e5371-a72b-4c72-8a98-7714e89d11a0/public/windows11.0-kb5036910-x64_4b455aa7ad2f9ed599ac9072f93f4259069a8e66.msu")
$global:patchIDs = @("KB5036910")
$global:imagesToPull = @(
"mcr.microsoft.com/windows/servercore:ltsc2022",
Expand Down Expand Up @@ -153,8 +154,6 @@ $global:map = @{
# 2. Keep 1.18.10, 1.18.14, 1.18.17, 1.18.18
# 3. Keep v1.18.17-hotfix.20210322 when adding v1.18.17-hotfix.20210505
"c:\akse-cache\win-k8s\" = @(
"https://acs-mirror.azureedge.net/kubernetes/v1.25.11-hotfix.20231102/windowszip/v1.25.11-hotfix.20231102-1int.zip",
"https://acs-mirror.azureedge.net/kubernetes/v1.25.15-hotfix.20231103/windowszip/v1.25.15-hotfix.20231103-1int.zip",
"https://acs-mirror.azureedge.net/kubernetes/v1.26.3-hotfix.20231102/windowszip/v1.26.3-hotfix.20231102-1int.zip",
"https://acs-mirror.azureedge.net/kubernetes/v1.26.6-hotfix.20231102/windowszip/v1.26.6-hotfix.20231102-1int.zip",
"https://acs-mirror.azureedge.net/kubernetes/v1.26.10-hotfix.20231103/windowszip/v1.26.10-hotfix.20231103-1int.zip",
Expand All @@ -178,7 +177,6 @@ $global:map = @{
"https://acs-mirror.azureedge.net/azure-cni/v1.4.39.2/binaries/azure-vnet-cni-singletenancy-overlay-windows-amd64-v1.4.39.2.zip"
);
"c:\akse-cache\calico\" = @(
"https://acs-mirror.azureedge.net/calico-node/v3.21.6/binaries/calico-windows-v3.21.6.zip",
"https://acs-mirror.azureedge.net/calico-node/v3.24.0/binaries/calico-windows-v3.24.0.zip"
);
"c:\akse-cache\tools\" = @(
Expand Down
15 changes: 15 additions & 0 deletions vhdbuilder/packer/test/windows-vhd-content-test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ function Test-RegistryAdded {
Validate-WindowsFixInFeatureManagement -Name 2059235981
Validate-WindowsFixInFeatureManagement -Name 3767762061
Validate-WindowsFixInFeatureManagement -Name 1102009996

Validate-WindowsFixInFeatureManagement -Name 2290715789
Validate-WindowsFixInFeatureManagement -Name 3152880268
}
if ($env:WindowsSKU -Like '2022*') {
Validate-WindowsFixInFeatureManagement -Name 2629306509
Expand Down Expand Up @@ -347,6 +350,18 @@ function Test-RegistryAdded {
Validate-WindowsFixInHnsState -Name HnsPreallocatePortRange
Validate-WindowsFixInFeatureManagement -Name 4154935436
Validate-WindowsFixInFeatureManagement -Name 124082829

Validate-WindowsFixInFeatureManagement -Name 3744292492
Validate-WindowsFixInFeatureManagement -Name 3838270605
Validate-WindowsFixInFeatureManagement -Name 851795084
Validate-WindowsFixInFeatureManagement -Name 26691724
Validate-WindowsFixInFeatureManagement -Name 3834988172
Validate-WindowsFixInFeatureManagement -Name 1535854221
Validate-WindowsFixInFeatureManagement -Name 3632636556
Validate-WindowsFixInFeatureManagement -Name 1552261773
Validate-WindowsFixInFeatureManagement -Name 4186914956
Validate-WindowsFixInFeatureManagement -Name 3173070476
Validate-WindowsFixInFeatureManagement -Name 3958450316
}
if ($env:WindowsSKU -Like '23H2*') {
Validate-WindowsFixInHnsState -Name NamespaceExcludedUdpPorts -Value 65330
Expand Down
20 changes: 10 additions & 10 deletions vhdbuilder/packer/windows-image.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@
# CLI example to get the latest image version:
# az vm image show --urn MicrosoftWindowsServer:WindowsServer:2019-Datacenter-Core-smalldisk:latest
WINDOWS_2019_BASE_IMAGE_SKU=2019-Datacenter-Core-smalldisk
WINDOWS_2019_BASE_IMAGE_VERSION=17763.5576.240304
WINDOWS_2019_BASE_IMAGE_VERSION=17763.5696.240406

# CLI example to get the latest image version:
# az vm image show --urn MicrosoftWindowsServer:WindowsServer:2022-Datacenter-Core-smalldisk:latest
WINDOWS_2022_BASE_IMAGE_SKU=2022-Datacenter-Core-smalldisk
WINDOWS_2022_BASE_IMAGE_VERSION=20348.2340.240303
WINDOWS_2022_BASE_IMAGE_VERSION=20348.2402.240405

# CLI example to get all available image version under a SKU (suffix g2 for Gen 2):
# az vm image list --all --publisher MicrosoftWindowsServer --offer WindowsServer --output table -s 2022-datacenter-core-smalldisk-g2
# CLI example to get the latest image version:
# az vm image show --urn MicrosoftWindowsServer:WindowsServer:2022-datacenter-core-smalldisk-g2:latest
WINDOWS_2022_GEN2_BASE_IMAGE_SKU=2022-datacenter-core-smalldisk-g2
WINDOWS_2022_GEN2_BASE_IMAGE_VERSION=20348.2340.240303
WINDOWS_2022_GEN2_BASE_IMAGE_VERSION=20348.2402.240405

# CLI example to get the latest image version:
# az vm image show --urn MicrosoftWindowsServer:WindowsServer:23H2-Datacenter-Core-smalldisk:latest
WINDOWS_23H2_BASE_IMAGE_SKU=23H2-Datacenter-Core-smalldisk
WINDOWS_23H2_BASE_IMAGE_VERSION=25398.2113.231109
# az vm image show --urn MicrosoftWindowsServer:WindowsServer:23H2-Datacenter-Core:latest
WINDOWS_23H2_BASE_IMAGE_SKU=23H2-Datacenter-Core
WINDOWS_23H2_BASE_IMAGE_VERSION=25398.830.240406

# CLI example to get all available image version under a SKU (suffix g2 for Gen 2):
# az vm image list --all --publisher MicrosoftWindowsServer --offer WindowsServer --output table -s 23H2-datacenter-core-smalldisk-g2
# az vm image list --all --publisher MicrosoftWindowsServer --offer WindowsServer --output table -s 23H2-datacenter-core-g2
# CLI example to get the latest image version:
# az vm image show --urn MicrosoftWindowsServer:WindowsServer:23H2-datacenter-core-smalldisk-g2:latest
WINDOWS_23H2_GEN2_BASE_IMAGE_SKU=23H2-datacenter-core-smalldisk-g2
WINDOWS_23H2_GEN2_BASE_IMAGE_VERSION=25398.2113.231109
# az vm image show --urn MicrosoftWindowsServer:WindowsServer:23H2-datacenter-core-g2:latest
WINDOWS_23H2_GEN2_BASE_IMAGE_SKU=23H2-datacenter-core-g2
WINDOWS_23H2_GEN2_BASE_IMAGE_VERSION=25398.830.240406

# Please uncomment the following lines and set a larger os disk size that is at least 30GB when your PR check-in fails
# WINDOWS_2019_CONTAINERD_OS_DISK_SIZE_GB=30
Expand Down
15 changes: 14 additions & 1 deletion vhdbuilder/packer/write-release-notes-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,20 @@ $wuRegistryNames = @(
"4154935436",
"124082829",
"NamespaceExcludedUdpPorts",
"PortExclusionChange"
"PortExclusionChange",
"2290715789",
"3152880268",
"3744292492",
"3838270605",
"851795084",
"26691724",
"3834988172",
"1535854221",
"3632636556",
"1552261773",
"4186914956",
"3173070476",
"3958450316"
)

foreach ($key in $wuRegistryKeys) {
Expand Down

0 comments on commit 793fff1

Please sign in to comment.