Containers/Get-ImageNameForRepo.ps1
function Get-ImageNameForRepo { Param( [ParameteR(Mandatory=$false)] [string] $Version, [Parameter(Mandatory=$false)] [string] $SourcePath = (Get-Location) ) if ($null -eq $Version -or $Version -eq "") { $Version = Get-EnvironmentKeyValue -SourcePath $SourcePath -KeyName 'version' } $image = (Get-EnvironmentKeyValue -SourcePath $SourcePath -KeyName 'versions') | Where-Object {$_.version -eq $Version} if ($null -eq $image) { throw "Could not find ImageName" } $ImageName = $image.containerImage if ($ImageName -ne '') { $ImageName } else { Set-ImageNameForRepo -SourcePath $SourcePath } } function Set-ImageNameForRepo { Param( [Parameter(Mandatory=$false)] [string]$SourcePath = (Get-Location), [Parameter(Mandatory=$true)] [string]$ImageName ) Set-EnvironmentKeyValue -SourcePath $SourcePath -KeyName 'image' -KeyValue $ImageName } |