Pipelines/Install-BcContainerHelper.ps1
Param( [string] $bcContainerHelperVersion = "", [string] $genericImageName = "" ) if (Get-Module -ListAvailable -Name BcContainerHelper) { $installedVersion = (Get-InstalledModule -Name BcContainerHelper).Version if ($bcContainerHelperVersion -eq "latest") { $latestVersion = (Find-Module -Name BcContainerHelper).Version if ($installedVersion -eq $latestVersion) { Write-Host "The latest version ($latestVersion) of BcContainerHelper module is already installed" } else { Write-Host "Installing the latest version of BcContainerHelper" Install-Module -Name BcContainerHelper -Force } } elseif ($installedVersion -eq $bcContainerHelperVersion) { Write-Host "Version $bcContainerHelperVersion of BcContainerHelper module is already installed" } else { Write-Host "Installing BcContainerHelper version $bcContainerHelperVersion" Install-Module -Name BcContainerHelper -RequiredVersion $bcContainerHelperVersion -Force Import-Module -Name BcContainerHelper -RequiredVersion $bcContainerHelperVersion } } else { Write-Host "BcContainerHelper module is not installed" if ($bcContainerHelperVersion -eq "latest") { Write-Host "Installing the latest version of BcContainerHelper" Install-Module -Name BcContainerHelper -Force } else { Write-Host "Installing BcContainerHelper version $bcContainerHelperVersion" Install-Module -Name BcContainerHelper -RequiredVersion $bcContainerHelperVersion -Force } } if ($genericImageName) { $bcContainerHelperConfig.genericImageName = $genericImageName } |