【发布时间】:2014-05-14 08:11:45
【问题描述】:
我有一个非常简单的 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
这会生成一个带有修订版#{Octopus.Release.Number} 的newrelic 部署。我也尝试过使用$OctopusParameters['Octopus.Release.Number'] 的长手版本,但这会产生一个修订版为System.Collections.Generic.Dictionary``2[System.String,System.String]['Octopus.Release.Number'] 的部署
我怎样才能让章鱼把实际的发行号发送到newrelic?
【问题讨论】:
-
不要使用newrelic,所以我不能真正测试,但我会试试这个:"deployment[revision]"= "$($OctopusParameters['Octopus.Release.Number']) "
-
完成了这项工作。想将您的评论移至答案以便我接受吗?
-
完成。很高兴解决了它!