DevOpsHandling/Get-DevOpsAllArtifactsFromFeed.ps1
<# .Synopsis Retrieves artifacts for a specific artifact from a feed .Description Retrieves all artifacts for a specific artifact name. The name is the part without the _app, _runtimeapp, _tests part .Parameter devOpsOrganization The DevOps organization that contains the artifacts .Parameter devOpsFeed The name of the DevOps artifact feed .Parameter devOpsArtifact The artifact name to get - it will get the _app, _runtimeapp, and _tests apps .Parameter devOpsToken PAT for DevOps .Parameter destination The output directory that the artifacts will be saved to .Parameter version The version of the artifact that should be retrieved. If not specified, it will be read from the settings.json .Example Get-DevOpsAllArtifactsFromFeed -devOpsArtifact "artifact" -destination "C:\Install" #> function Get-DevOpsAllArtifactsFromFeed { param ( [Parameter(Mandatory = $false)] [string]$devOpsOrganization = "", [Parameter(Mandatory = $false)] [string]$devOpsFeed = "", [Parameter(Mandatory = $true)] [string]$devOpsArtifact, [Parameter(Mandatory = $false)] [string]$devOpsToken = "", [Parameter(Mandatory = $true)] [string]$destination, [Parameter(Mandatory = $false)] [string]$version ) if ($devOpsOrganization -eq "") { $devOpsOrganization = Get-EnvironmentKeyValue -KeyName "Organization" } $devOpsToken = Get-DevOpsToken -SourcePath (Get-Location) if (!(Test-Path $destination)) { New-Item -Path $destination -ItemType Directory | Out-Null } $dependencies = Get-EnvironmentKeyValue -KeyName "dependencies" if ($devOpsFeed -eq "") { if ($null -ne $dependencies) { if ($dependencies -ne '') { $devOpsFeed = $dependencies[0].devOpsFeed } } } if ($null -ne $dependencies) { $version = $dependencies[0].version } if ($version -ne "") { $version = "{0}.{1}.{2}" -f ([version]$version).Major, ([version]$version).Minor, ([version]$version).Build } else { $version = "*" } if ($devopsFeed -ne "") { Get-DevOpsArtifactsFromFeed -devOpsOrganization $devOpsOrganization -devOpsFeed $devOpsFeed -devOpsArtifact "$($devOpsArtifact)_app" -destination $destination -version $version Get-DevOpsArtifactsFromFeed -devOpsOrganization $devOpsOrganization -devOpsFeed $devOpsFeed -devOpsArtifact "$($devOpsArtifact)_runtime" -destination $destination -version $version Get-DevOpsArtifactsFromFeed -devOpsOrganization $devOpsOrganization -devOpsFeed $devOpsFeed -devOpsArtifact "$($devOpsArtifact)_tests" -destination $destination -version $version } } |