mirror of
https://github.com/actions/runner-images.git
synced 2025-12-12 12:06:59 +00:00
Fix failure when tags are set for Ubuntu 22 generation (#7417)
This commit is contained in:
committed by
GitHub
parent
f01bed49d5
commit
3220eb4c1b
@@ -268,8 +268,12 @@ Function GenerateResourcesAndImage {
|
||||
} else {
|
||||
$AgentIp = "[]"
|
||||
}
|
||||
if (-not $Tags) {
|
||||
$Tags = @{}
|
||||
}
|
||||
}
|
||||
|
||||
if ($builderScriptPath.Contains(".json")) {
|
||||
if ($Tags) {
|
||||
$builderScriptPath_temp = $builderScriptPath.Replace(".json", "-temp.json")
|
||||
$packer_script = Get-Content -Path $builderScriptPath | ConvertFrom-Json
|
||||
@@ -277,6 +281,7 @@ Function GenerateResourcesAndImage {
|
||||
$packer_script | ConvertTo-Json -Depth 3 | Out-File $builderScriptPath_temp
|
||||
$builderScriptPath = $builderScriptPath_temp
|
||||
}
|
||||
}
|
||||
|
||||
& $packerBinary build -on-error="$($OnError)" `
|
||||
-var "client_id=$($spClientId)" `
|
||||
@@ -288,6 +293,7 @@ Function GenerateResourcesAndImage {
|
||||
-var "storage_account=$($storageAccountName)" `
|
||||
-var "install_password=$($InstallPassword)" `
|
||||
-var "allowed_inbound_ip_addresses=$($AgentIp)" `
|
||||
-var "azure_tags=$($Tags | ConvertTo-Json -Compress)" `
|
||||
$builderScriptPath
|
||||
}
|
||||
catch {
|
||||
|
||||
@@ -4,7 +4,7 @@ variable "allowed_inbound_ip_addresses" {
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "azure_tag" {
|
||||
variable "azure_tags" {
|
||||
type = map(string)
|
||||
default = {}
|
||||
}
|
||||
@@ -171,7 +171,7 @@ source "azure-arm" "build_vhd" {
|
||||
vm_size = "${var.vm_size}"
|
||||
|
||||
dynamic "azure_tag" {
|
||||
for_each = var.azure_tag
|
||||
for_each = var.azure_tags
|
||||
content {
|
||||
name = azure_tag.key
|
||||
value = azure_tag.value
|
||||
|
||||
Reference in New Issue
Block a user