mirror of
https://github.com/actions/runner-images.git
synced 2025-12-10 19:16:48 +00:00
Escape quotes when running in PowerShell 7.0-7.2 (#8705)
This commit is contained in:
committed by
GitHub
parent
2d1868a050
commit
2094c7eb2c
@@ -174,6 +174,10 @@ Function GenerateResourcesAndImage {
|
||||
Write-Verbose "PowerShell 5 detected. Replacing double quotes with escaped double quotes in allowed inbound IP addresses."
|
||||
$AllowedInboundIpAddresses = '[\"{0}\"]' -f $AgentIp
|
||||
}
|
||||
elseif ($PSVersionTable.PSVersion.Major -eq 7 -and $PSVersionTable.PSVersion.Minor -le 2) {
|
||||
Write-Verbose "PowerShell 7.0-7.2 detected. Replacing double quotes with escaped double quotes in allowed inbound IP addresses."
|
||||
$AllowedInboundIpAddresses = '[\"{0}\"]' -f $AgentIp
|
||||
}
|
||||
else {
|
||||
$AllowedInboundIpAddresses = '["{0}"]' -f $AgentIp
|
||||
}
|
||||
@@ -200,6 +204,10 @@ Function GenerateResourcesAndImage {
|
||||
Write-Verbose "PowerShell 5 detected. Replacing double quotes with escaped double quotes in tags JSON."
|
||||
$TagsJson = $TagsJson -replace '"', '\"'
|
||||
}
|
||||
elseif ($PSVersionTable.PSVersion.Major -eq 7 -and $PSVersionTable.PSVersion.Minor -le 2) {
|
||||
Write-Verbose "PowerShell 7.0-7.2 detected. Replacing double quotes with escaped double quotes in tags JSON."
|
||||
$TagsJson = $TagsJson -replace '"', '\"'
|
||||
}
|
||||
Write-Debug "Tags JSON: $TagsJson."
|
||||
if ($TemplatePath.Contains(".json")) {
|
||||
Write-Verbose "Injecting tags into packer template."
|
||||
|
||||
Reference in New Issue
Block a user