Skip to content

Instantly share code, notes, and snippets.

@joshrobb
Created November 2, 2014 02:27
Show Gist options
  • Save joshrobb/0f37c195e7e8889b3d7e to your computer and use it in GitHub Desktop.
Save joshrobb/0f37c195e7e8889b3d7e to your computer and use it in GitHub Desktop.
Octopus Deploy Annotate Librato
$encoded = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("user@example:apikey" ))
$headers = @{Authorization = "Basic "+$encoded}
if ($OctopusEnvironmentName -eq 'Production') {
$envname = "prod"
} else {
$envname = "qa"
}
#OH yeah - that doesn't work @#$@#$@#$@#$@#$@#$ in PS2
#$r = Invoke-WebRequest -Uri "https://metrics-api.librato.com/v1/annotations/$envname.deploys" -Headers $headers -Method POST -Body "title=Deployed $OctopusReleaseNumber"
$wc = (New-Object System.Net.WebClient)
$wc.Headers["Content-Type"] = "application/x-www-form-urlencoded"
$wc.Headers["Authorization"] = "Basic "+$encoded
$wc.UploadString("https://metrics-api.librato.com/v1/annotations/$envname.deploys","title=Deployed $OctopusReleaseNumber&description=Deployed $OctopusReleaseNumber")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment