70 lines
2.3 KiB
PowerShell
70 lines
2.3 KiB
PowerShell
|
function Get-PackageAlkamiManifestV2 {
|
||
|
<#
|
||
|
.SYNOPSIS
|
||
|
Returns the AlkamiManifest content for the given package if it's found in Proget
|
||
|
|
||
|
.PARAMETER FeedSource
|
||
|
[string] Source feed used to look up the package by
|
||
|
|
||
|
.PARAMETER Name
|
||
|
[string] Package name to lookup
|
||
|
|
||
|
.PARAMETER Version
|
||
|
[string] Package version to lookup
|
||
|
|
||
|
.PARAMETER Package
|
||
|
[Object] Known package object with properties as { Feed={ Source=; Name=; } Name=; Version=; }
|
||
|
|
||
|
.PARAMETER Credential
|
||
|
[PSCredential] Credential used for talking to feeds as needed
|
||
|
#>
|
||
|
[CmdletBinding(DefaultParameterSetName='RawArgs')]
|
||
|
Param(
|
||
|
[Parameter(Mandatory = $true, ParameterSetName = 'RawArgs')]
|
||
|
[string]$FeedSource,
|
||
|
[Parameter(Mandatory = $true, ParameterSetName = 'RawArgs')]
|
||
|
[string]$Name,
|
||
|
[Parameter(Mandatory = $true, ParameterSetName = 'RawArgs')]
|
||
|
[string]$Version,
|
||
|
|
||
|
[Parameter(Mandatory = $true, ParameterSetName = 'Package')]
|
||
|
[object]$Package,
|
||
|
|
||
|
[Parameter(Mandatory = $false)]
|
||
|
[PSCredential]$Credential = $null
|
||
|
)
|
||
|
|
||
|
## TODO: Can this pull from the local filesystem if it exists?
|
||
|
## This would let us fetch faster if the versions match as we could avoid network hops.
|
||
|
|
||
|
$loglead = Get-LogLeadName
|
||
|
|
||
|
if ($PSCmdlet.ParameterSetName -eq 'Package') {
|
||
|
$FeedSource = $Package.Feed.Source
|
||
|
$Name = $Package.Name
|
||
|
$Version = $Package.Version
|
||
|
}
|
||
|
|
||
|
Write-Verbose "$loglead : Querying for Alkami manifest from proget for package [$Name]"
|
||
|
|
||
|
$splatVar = @{
|
||
|
FeedSource = $FeedSource
|
||
|
Name = $Name
|
||
|
Version = $Version
|
||
|
Credential = $Credential
|
||
|
|
||
|
PackagePath = "" #filled in below
|
||
|
}
|
||
|
|
||
|
foreach($validManifestFilename in (Get-ValidPackageManifestFilenames)) {
|
||
|
$splatVar.PackagePath = $validManifestFilename
|
||
|
$result = (Get-PackageFileV2 @splatVar)
|
||
|
if (![string]::IsNullOrWhiteSpace($result)) {
|
||
|
return (Get-PackageManifest -RawContent $result -PackageName $Name -ManifestSource "$FeedSource $Name $Version")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Write-Host "$logLead : No manifest found in Proget for [$Name]"
|
||
|
return $null
|
||
|
}
|