mirror of
https://dev.azure.com/effectory/Survey%20Software/_git/Cloud%20Engineering
synced 2026-02-27 18:52:18 +01:00
65 lines
2.8 KiB
PowerShell
65 lines
2.8 KiB
PowerShell
|
|
class PipelineInfo {
|
|
[string] $Id = ""
|
|
[string] $Name = ""
|
|
[string] $Path = ""
|
|
[string] $Type = ""
|
|
[string] $Author = ""
|
|
[string] $CreatedDate = ""
|
|
[string] $PipelineType = ""
|
|
[string] $PipelineEditUrl = ""
|
|
}
|
|
|
|
$token = "hyrvwxicogy37djvmhkwrcdexokcrpyudkk4j2n3n7gnjb5wsv5a"
|
|
$token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($token)"))
|
|
$organization = "effectory"
|
|
$project = "Survey%20Software"
|
|
$head = @{ Authorization =" Basic $token" }
|
|
|
|
function GetPipelineType {
|
|
|
|
param (
|
|
[int] $pipeLineId
|
|
)
|
|
|
|
$url = "https://dev.azure.com/$organization/$project/_apps/hub/ms.vss-build-web.ci-designer-hub?pipelineId=$pipeLineId&__rt=fps&__ver=2"
|
|
$response = Invoke-RestMethod -Uri $url -Method GET -Headers $head
|
|
return $response.fps.dataProviders.data."ms.vss-build-web.pipeline-detail-data-provider".definitionProcessType
|
|
}
|
|
|
|
[string] $date = Get-Date -Format "yyyy-MM-dd HHmm"
|
|
$fileName = ".\$date pipelines.csv"
|
|
|
|
Write-Host "========================================================================================================================================================================"
|
|
Write-Host "Creating service connection overview."
|
|
Write-Host "========================================================================================================================================================================"
|
|
|
|
|
|
$url="https://dev.azure.com/$organization/$project/_apis/build/definitions?api-version=7.1-preview.7"
|
|
$response = Invoke-RestMethod -Uri $url -Method GET -Headers $head
|
|
|
|
[PipelineInfo[]]$Result = @()
|
|
$response.value | ForEach-Object {
|
|
|
|
$definitionProcessType = GetPipelineType -pipeLineId $_.id
|
|
|
|
[PipelineInfo] $pipelineInfo = [PipelineInfo]::new()
|
|
$pipelineInfo.Id = $_.id
|
|
$pipelineInfo.Name = $_.name
|
|
$pipelineInfo.Path = $_.path
|
|
$pipelineInfo.Type = $_.type
|
|
$pipelineInfo.Author = $_.authoredby.DisplayName
|
|
$pipelineInfo.CreatedDate = $_.createdDate
|
|
$pipelineInfo.PipelineType = $definitionProcessType -eq 1 ? "Classic" : "Yaml"
|
|
$pipelineInfo.PipelineEditUrl = $definitionProcessType -eq 1 ?
|
|
"https://dev.azure.com/$organization/$project/_apps/hub/ms.vss-ciworkflow.build-ci-hub?_a=edit-build-definition&id=$($_.id)" :
|
|
"https://dev.azure.com/$organization/$project/_apps/hub/ms.vss-build-web.ci-designer-hub?pipelineId=$($_.id)&branch=master"
|
|
$Result += $pipelineInfo
|
|
|
|
|
|
}
|
|
|
|
$Result | Export-Csv -Path $fileName -Append -NoTypeInformation
|
|
|
|
Write-Host "========================================================================================================================================================================"
|
|
Write-Host "Done." |