Skip to content

Instantly share code, notes, and snippets.

@pawelpabich
Last active June 21, 2016 03:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pawelpabich/8a9f09006a785c5e4959fc3f37a4bbc4 to your computer and use it in GitHub Desktop.
Save pawelpabich/8a9f09006a785c5e4959fc3f37a4bbc4 to your computer and use it in GitHub Desktop.
$OctopusURL = "http://localhost:8065"
$OctopusAPIKey = "API-XXXXXXXXXXXXX"
$environmentID = $OctopusParameters['Octopus.Environment.Id'] #Id of the environment where you want to run the health check. During a deployment you can use the variable $OctopusParameters['Octopus.Environment.Id'] to get this value.
Write-host "Env $environmentID"
$header = @{ "X-Octopus-ApiKey" = $OctopusAPIKey }
$body = @"
{
"Name":"Health",
"Description":"Check Deployment Target health in Development",
"Arguments":{
"Timeout":"00:05:00",
"EnvironmentId":`"$environmentID`"
}
}
"@
Write-host "Body $body"
Invoke-WebRequest -Uri $OctopusURL/api/tasks -Body $body -Headers $header -Method Pos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment