mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 22:26:56 +00:00
[ImageGen] Fix allowed_inbound_ip_addresses error (#5597)
* Fix allowed_inbound_ip_addresses error * Add space
This commit is contained in:
committed by
GitHub
parent
de68d8faea
commit
c3fb682f73
@@ -119,7 +119,7 @@ Function GenerateResourcesAndImage {
|
|||||||
[Parameter(Mandatory = $False)]
|
[Parameter(Mandatory = $False)]
|
||||||
[bool] $EnableHttpsTrafficOnly = $False,
|
[bool] $EnableHttpsTrafficOnly = $False,
|
||||||
[Parameter(Mandatory = $False)]
|
[Parameter(Mandatory = $False)]
|
||||||
[Hashtable] $tags
|
[hashtable] $Tags
|
||||||
)
|
)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -260,15 +260,19 @@ Function GenerateResourcesAndImage {
|
|||||||
throw "'packer' binary is not found on PATH"
|
throw "'packer' binary is not found on PATH"
|
||||||
}
|
}
|
||||||
|
|
||||||
if($RestrictToAgentIpAddress -eq $true) {
|
if ($RestrictToAgentIpAddress) {
|
||||||
$AgentIp = (Invoke-RestMethod http://ipinfo.io/json).ip
|
$AgentIp = (Invoke-RestMethod http://ipinfo.io/json).ip
|
||||||
Write-Host "Restricting access to packer generated VM to agent IP Address: $AgentIp"
|
Write-Host "Restricting access to packer generated VM to agent IP Address: $AgentIp"
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($tags) {
|
if ($builderScriptPath.Contains("pkr.hcl")) {
|
||||||
|
$AgentIp = '[ \"{0}\" ]' -f $AgentIp
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Tags) {
|
||||||
$builderScriptPath_temp = $builderScriptPath.Replace(".json", "-temp.json")
|
$builderScriptPath_temp = $builderScriptPath.Replace(".json", "-temp.json")
|
||||||
$packer_script = Get-Content -Path $builderScriptPath | ConvertFrom-Json
|
$packer_script = Get-Content -Path $builderScriptPath | ConvertFrom-Json
|
||||||
$packer_script.builders | Add-Member -Name "azure_tags" -Value $tags -MemberType NoteProperty
|
$packer_script.builders | Add-Member -Name "azure_tags" -Value $Tags -MemberType NoteProperty
|
||||||
$packer_script | ConvertTo-Json -Depth 3 | Out-File $builderScriptPath_temp
|
$packer_script | ConvertTo-Json -Depth 3 | Out-File $builderScriptPath_temp
|
||||||
$builderScriptPath = $builderScriptPath_temp
|
$builderScriptPath = $builderScriptPath_temp
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
variable "allowed_inbound_ip_addresses" {
|
variable "allowed_inbound_ip_addresses" {
|
||||||
|
type = list(string)
|
||||||
default = []
|
default = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user