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,14 +268,19 @@ Function GenerateResourcesAndImage {
|
|||||||
} else {
|
} else {
|
||||||
$AgentIp = "[]"
|
$AgentIp = "[]"
|
||||||
}
|
}
|
||||||
|
if (-not $Tags) {
|
||||||
|
$Tags = @{}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Tags) {
|
if ($builderScriptPath.Contains(".json")) {
|
||||||
$builderScriptPath_temp = $builderScriptPath.Replace(".json", "-temp.json")
|
if ($Tags) {
|
||||||
$packer_script = Get-Content -Path $builderScriptPath | ConvertFrom-Json
|
$builderScriptPath_temp = $builderScriptPath.Replace(".json", "-temp.json")
|
||||||
$packer_script.builders | Add-Member -Name "azure_tags" -Value $Tags -MemberType NoteProperty
|
$packer_script = Get-Content -Path $builderScriptPath | ConvertFrom-Json
|
||||||
$packer_script | ConvertTo-Json -Depth 3 | Out-File $builderScriptPath_temp
|
$packer_script.builders | Add-Member -Name "azure_tags" -Value $Tags -MemberType NoteProperty
|
||||||
$builderScriptPath = $builderScriptPath_temp
|
$packer_script | ConvertTo-Json -Depth 3 | Out-File $builderScriptPath_temp
|
||||||
|
$builderScriptPath = $builderScriptPath_temp
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
& $packerBinary build -on-error="$($OnError)" `
|
& $packerBinary build -on-error="$($OnError)" `
|
||||||
@@ -288,6 +293,7 @@ Function GenerateResourcesAndImage {
|
|||||||
-var "storage_account=$($storageAccountName)" `
|
-var "storage_account=$($storageAccountName)" `
|
||||||
-var "install_password=$($InstallPassword)" `
|
-var "install_password=$($InstallPassword)" `
|
||||||
-var "allowed_inbound_ip_addresses=$($AgentIp)" `
|
-var "allowed_inbound_ip_addresses=$($AgentIp)" `
|
||||||
|
-var "azure_tags=$($Tags | ConvertTo-Json -Compress)" `
|
||||||
$builderScriptPath
|
$builderScriptPath
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ variable "allowed_inbound_ip_addresses" {
|
|||||||
default = []
|
default = []
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "azure_tag" {
|
variable "azure_tags" {
|
||||||
type = map(string)
|
type = map(string)
|
||||||
default = {}
|
default = {}
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,7 @@ source "azure-arm" "build_vhd" {
|
|||||||
vm_size = "${var.vm_size}"
|
vm_size = "${var.vm_size}"
|
||||||
|
|
||||||
dynamic "azure_tag" {
|
dynamic "azure_tag" {
|
||||||
for_each = var.azure_tag
|
for_each = var.azure_tags
|
||||||
content {
|
content {
|
||||||
name = azure_tag.key
|
name = azure_tag.key
|
||||||
value = azure_tag.value
|
value = azure_tag.value
|
||||||
|
|||||||
Reference in New Issue
Block a user