Files
runner-images/images/win/scripts/Installers/Install-BizTalkBuildComponent.ps1
Elvis Shi 3a7123ebeb Add BizTalk Server project build component to build agent machine. (#1960)
* Add BizTalk Project Build components, including msi and vsix.

* Add BizTalk Build Components to software report.

* Use registry/folder check replace actually BizTalk Project building for testing purpose.

* Remove unnecessary try/catch.

* Make sure BizTalk related software report only for Windows 2019 OS.

* Add statement to make sure BizTalk test only invoked in Win19 env.

* Fix test failue when no test runs use "skip"

* Update the TestName to be identity to BizTalk.Test.ps1
2020-11-24 19:20:02 +03:00

83 lines
2.4 KiB
PowerShell

################################################################################
## File: Install-BizTalkBuildComponent.ps1
## Desc: Install BizTalk Project Build Component
################################################################################
function Install-Msi
{
<#
.SYNOPSIS
A helper function to install executables.
.DESCRIPTION
install .exe or .msi binaries from specified Path.
.PARAMETER MsiPath
Msi or exe path. Required parameter.
.PARAMETER LogPath
The log file path where installation will write log to. Required parameter.
.EXAMPLE
Install-Msi -MsiPath "c:\temp\abc.msi" -LogPath "c:\abc.log"
#>
Param
(
[Parameter(Mandatory)]
[String] $MsiPath,
[Parameter(Mandatory)]
[String] $LogPath
)
try
{
$filePath = "msiexec.exe"
Write-Host "Starting Install $MsiPath..."
$ArgumentList = ('/i', $MsiPath, '/QN', '/norestart', "/l*v",$LogPath)
$process = Start-Process -FilePath $filePath -ArgumentList $ArgumentList -Wait -PassThru -Verb runAs
$exitCode = $process.ExitCode
if ($exitCode -eq 0 -or $exitCode -eq 3010)
{
Write-Host "Installation for $MsiPath is successful."
}
else
{
Write-Host "Non zero exit code returned by $MsiPath installation process: $exitCode"
Get-Content $LogPath | Write-Host
exit $exitCode
}
}
catch
{
Write-Host "Failed to install $MsiPath : $($_.Exception.Message)"
exit 1
}
}
$bizTalkBuildComponentUri = "https://aka.ms/BuildComponentSetup.EN"
# Download
Write-Host "BizTalk Project Build Component download..."
$setupZipFile = Start-DownloadWithRetry -Url $bizTalkBuildComponentUri -Name "BuildComponentSetup.EN.zip"
# Unzip
$setupPath = "C:\BizTalkBuildComponent"
if (-not (Test-Path -Path $setupPath)) {
$null = New-Item -Path $setupPath -ItemType Directory -Force
}
Write-Host "Unzip $setupZipFile to $setupPath..."
Extract-7Zip -Path $setupZipFile -DestinationPath $setupPath
Remove-Item $setupZipFile
# Install
Install-Msi -MsiPath "$setupPath\Bootstrap.msi" -LogPath "$setupPath\bootstrap.log"
Install-Msi -MsiPath "$setupPath\BuildComponentSetup.msi" -LogPath "$setupPath\buildComponentSetup.log"
Remove-Item $setupPath -Recurse -Force
# Test
Invoke-PesterTests -TestFile "BizTalk" -TestName "BizTalk Build Component Setup"