From d63f81b274a6e1dc0540af65765b8ce3165a575d Mon Sep 17 00:00:00 2001 From: Erik Bershel <110455084+erik-bershel@users.noreply.github.com> Date: Fri, 20 Sep 2024 16:06:10 +0200 Subject: [PATCH] [macOS] Update base image generation to work with Sequoia updates (#10651) Co-authored-by: sarathrajsrinivasan <159180023+sarathrajsrinivasan@users.noreply.github.com> --- images.CI/macos/anka/CreateCleanAnkaTemplate.ps1 | 5 +++-- images.CI/macos/anka/Service.Helpers.psm1 | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/images.CI/macos/anka/CreateCleanAnkaTemplate.ps1 b/images.CI/macos/anka/CreateCleanAnkaTemplate.ps1 index 0c817fb6f572..4d7e545e0199 100644 --- a/images.CI/macos/anka/CreateCleanAnkaTemplate.ps1 +++ b/images.CI/macos/anka/CreateCleanAnkaTemplate.ps1 @@ -93,8 +93,9 @@ function Invoke-SoftwareUpdate { $command = "sw_vers" $guestMacosVersion = Invoke-SSHPassCommand -HostName $ipAddress -Command $command switch -regex ($guestMacosVersion[1]) { - '12.\d' { $nextOSVersion = 'macOS Ventura|macOS Sonoma' } - '13.\d' { $nextOSVersion = 'macOS Sonoma' } + '12.\d' { $nextOSVersion = 'macOS Ventura|macOS Sonoma|macOS Sequoia' } + '13.\d' { $nextOSVersion = 'macOS Sonoma|macOS Sequoia' } + '14.\d' { $nextOSVersion = 'macOS Sequoia' } } Write-Host "`t[*] Fetching Software Updates ready to install on '$TemplateName' VM:" diff --git a/images.CI/macos/anka/Service.Helpers.psm1 b/images.CI/macos/anka/Service.Helpers.psm1 index 188ea01266c2..f8368b26fcc2 100644 --- a/images.CI/macos/anka/Service.Helpers.psm1 +++ b/images.CI/macos/anka/Service.Helpers.psm1 @@ -39,14 +39,15 @@ function Invoke-SoftwareUpdateArm64 { $command = "sw_vers" $guestMacosVersion = Invoke-SSHPassCommand -HostName $HostName -Command $command switch -regex ($guestMacosVersion[1]) { - '13.\d' { $nextOSVersion = 'Sonoma' } - '14.\d' { $nextOSVersion = 'NotYetDefined' } + '12.\d' { $nextOSVersion = 'macOS Ventura|macOS Sonoma|macOS Sequoia' } + '13.\d' { $nextOSVersion = 'macOS Sonoma|macOS Sequoia' } + '14.\d' { $nextOSVersion = 'macOS Sequoia' } } $url = "https://raw.githubusercontent.com/actions/runner-images/main/images/macos/assets/auto-software-update-arm64.exp" $script = Invoke-RestMethod -Uri $url - foreach ($update in $listOfUpdates) { - if ($update -notmatch "$nextOSVersion") { + foreach ($update in $ListOfUpdates) { + if ($update -notmatch $nextOSVersion) { $updatedScript = $script.Replace("MACOSUPDATE", $($($update.trim()).Replace(" ","\ "))) $base64 = [Convert]::ToBase64String($updatedScript.ToCharArray()) $command = "echo $base64 | base64 --decode > ./auto-software-update-arm64.exp;chmod +x ./auto-software-update-arm64.exp; ./auto-software-update-arm64.exp ${Password};rm ./auto-software-update-arm64.exp"