mirror of
https://github.com/actions/runner-images.git
synced 2025-12-10 11:07:02 +00:00
Fix issue where tags json is wrong in PS5 (#8058)
This commit is contained in:
committed by
GitHub
parent
4ec9fdae13
commit
6ed173f0ad
@@ -288,6 +288,12 @@ Function GenerateResourcesAndImage {
|
||||
}
|
||||
}
|
||||
|
||||
$TagsJson = $Tags | ConvertTo-Json -Compress
|
||||
if ($PSVersionTable.PSVersion.Major -eq 5) {
|
||||
Write-Verbose "PowerShell 5 detected. Replacing double quotes with escaped double quotes in tags JSON."
|
||||
$TagsJson = $TagsJson -replace '"', '\"'
|
||||
}
|
||||
|
||||
& $packerBinary build -on-error="$($OnError)" `
|
||||
-var "client_id=$($spClientId)" `
|
||||
-var "client_secret=$($ServicePrincipalClientSecret)" `
|
||||
@@ -298,7 +304,7 @@ Function GenerateResourcesAndImage {
|
||||
-var "storage_account=$($storageAccountName)" `
|
||||
-var "install_password=$($InstallPassword)" `
|
||||
-var "allowed_inbound_ip_addresses=$($AgentIp)" `
|
||||
-var "azure_tags=$($Tags | ConvertTo-Json -Compress)" `
|
||||
-var "azure_tags=$($TagsJson)" `
|
||||
$builderScriptPath
|
||||
}
|
||||
catch {
|
||||
|
||||
Reference in New Issue
Block a user