Last active
August 29, 2015 14:19
-
-
Save Damovisa/fb6dc48038a2c2ad9216 to your computer and use it in GitHub Desktop.
Get all parent and child steps for all projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$octoBase = "http://octopusserver:port" | |
$apiKey = "API-XXXXXXXXXX" | |
Function GetFromOctopus([string]$relUrl) { | |
return Invoke-RestMethod -Uri "$octoBase$relUrl\?apiKey=$apiKey" -Method Get | |
} | |
$projects = GetFromOctopus -relUrl "/api/projects/all" | |
ForEach ($p in $projects.Items) { | |
$processLink = $p.Links.DeploymentProcess | |
$steps = GetFromOctopus $processLink | |
$stepCount = 0 | |
$actionCount = 0 | |
ForEach ($s in $steps) { | |
$stepCount += $s.Steps.Count | |
ForEach ($a in $steps.Steps) { | |
$actionCount += $a.Actions.Count | |
} | |
} | |
Write-Output "$($p.Name) has $stepCount top-level steps and $actionCount total steps" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment