Skip to content

Commit 2051564

Browse files
Set static UUID to the clean image (#8564)
1 parent de1f529 commit 2051564

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

images.CI/macos/anka/Anka.Helpers.psm1

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,3 +233,19 @@ function Wait-AnkaVMSSHService {
233233
exit 1
234234
}
235235
}
236+
237+
function Set-AnkaVMUuid {
238+
param(
239+
[Parameter(Mandatory)]
240+
[ValidateNotNullOrEmpty()]
241+
[string] $VMName,
242+
243+
[Parameter(Mandatory)]
244+
[ValidateNotNullOrEmpty()]
245+
[string] $Uuid
246+
)
247+
248+
$command = "anka modify $VMName set custom-variable hw.uuid $Uuid"
249+
Write-Host "`t[*] Setting $VMName uuid to $Uuid"
250+
Invoke-AnkaCommand -Command $command
251+
}

images.CI/macos/anka/CreateCleanAnkaTemplate.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ param(
2727
[int] $RamSizeGb = 7,
2828
[int] $DiskSizeGb = 300,
2929
[string] $DisplayResolution = "1920x1080",
30-
[string] $TagName = [DateTimeOffset]::Now.ToUnixTimeSeconds()
30+
[string] $TagName = [DateTimeOffset]::Now.ToUnixTimeSeconds(),
31+
[string] $Uuid = "4203018E-580F-C1B5-9525-B745CECA79EB"
3132
)
3233

3334
$ErrorActionPreference = "Stop"
@@ -205,6 +206,9 @@ Set-AnkaVMVideoController -VMName $TemplateName -ShortMacOSVersion $ShortMacOSVe
205206
Write-Host "`t[*] Setting screen resolution to $DisplayResolution for $TemplateName"
206207
Set-AnkaVMDisplayResolution -VMName $TemplateName -DisplayResolution $DisplayResolution
207208

209+
# Set static UUID
210+
Set-AnkaVMUuid -VMName $TemplateName -Uuid $Uuid
211+
208212
if ($PushToRegistry) {
209213
# Push a VM template (and tag) to the Cloud
210214
Write-Host "`t[*] Pushing '$TemplateName' image with '$TagName' tag to the '$RegistryUrl' registry..."

0 commit comments

Comments
 (0)