我有一个非常简单的PowerShell脚本,用于在特定组件完成部署后通知Newrelic。我的问题是,我无法正确地发送发布版本号。
我使用的脚本是:
$NewRelicUri = "https://api.newrelic.com/deployments.xml"
$body = @{
"deployment[app_name]" = "PB.Website";
"deployment[revision]"= "#{Octopus.Release.Number}";
}
Write-Host "Sending notification to $NewRelicUri..."
Invoke-WebRequest -Uri $NewRelicUri -Headers @{ "x-api-key"="XXX" } -Method Post -Body $body -UseBasicParsing
这将在newrelic中生成一个部署,版本号为
#{Octopus.Release.Number}
。我还尝试使用$OctopusParameters['Octopus.Release.Number']
的长手写版本,但这会生成一个带有版本号System.Collections.Generic.Dictionary``2[System.String,System.String]['Octopus.Release.Number']
的部署。如何让Octopus将实际的发布号发送到newrelic?