Testing/Install-BuildHelper.ps1
function Install-BuildHelper { param ( # Container name to install the Build Helper into [Parameter(Mandatory=$false)] [string] $ContainerName = (Get-ContainerFromLaunchJson), # Whether to force a reinstall of the app [Parameter(Mandatory=$false)] [switch] $Reinstall, # Version of the build helper app to install, use BC15 if not specified [Parameter(Mandatory=$false)] [string] [ValidateSet('Detect','BC14','BC15')] $BuildHelperVersion = 'Detect' ) $Install = $false if ($Reinstall.IsPresent) { $Install = $true } else { #test for the existence of the build helper service try { $Uri = 'http://{0}:7047/{1}/WS/Codeunit/AutomatedTestMgt?tenant=default' -f (Get-NavContainerIpAddress $ContainerName), (Get-ContainerWebServerInstance $ContainerName) Invoke-WebRequest $Uri -Credential (New-CredentialFromEnvironmentJson) | Out-Null } catch { $Install = $true } } if ($Install) { if ($BuildHelperVersion -eq 'Detect') { [Version]$PlatformVersion = [Version]::Parse((Get-AppKeyValue -KeyName 'platform')) if ($PlatformVersion -ge ([Version]::Parse('15.0.0.0'))) { $BuildHelperVersion = 'BC15' } else { $BuildHelperVersion = 'BC14' } } $DestinationFile = Join-Path (Create-TempDirectory) 'Build_Helper.app' switch ($BuildHelperVersion) { 'BC14' { $SourceURL = Get-TFSConfigKeyValue -KeyName 'buildHelperBC14URL' } 'BC15' { $SourceURL = Get-TFSConfigKeyValue -KeyName 'buildHelperURL' } } Download-File -sourceUrl $SourceURL -destinationFile $DestinationFile Publish-NavContainerApp -containerName $ContainerName -appFile $DestinationFile -install -sync } } Export-ModuleMember -Function Install-BuildHelper |