我有一个非常简单的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']修订版的部署。
我怎样才能让章鱼把实际的发行号码发送到新的文物?
发布于 2014-05-14 12:22:09
我不使用NewRelic,所以我不能真正测试它,但是在长手版本中得到的错误表明您需要为该值使用一个子表达式:
"deployment[revision]"= "$($OctopusParameters['Octopus.Release.Number'])" 如果发布号已经是字符串,那么您可能只需要:
"deployment[revision]" = $OctopusParameters['Octopus.Release.Number']https://stackoverflow.com/questions/23649055
复制相似问题