Functions/WorkInProgress/Get-GocdJob.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function Get-GocdJob {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [string]
        $Pipeline
        ,
        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [string]
        $Stage
    )

    $Config = Get-GocdPipelineConfiguration -Pipeline $Pipeline
    $Config | ConvertFrom-Json | Select-Object -ExpandProperty stages | Where-Object { $_.name -ieq $Stage } | Select-Object -ExpandProperty jobs | Select-Object -ExpandProperty name
}