Improve Windows helpers functions stability (#723)

* Rework windows InstallHelpers; Add retry logic to install function
This commit is contained in:
Maksim Petrov
2020-04-21 11:58:27 +03:00
committed by GitHub
parent 54a14f61b3
commit 8e8fbb4f76
15 changed files with 197 additions and 227 deletions

View File

@@ -5,4 +5,7 @@
Import-Module -Name ImageHelpers -Force
Install-MSI -MsiUrl "https://aka.ms/cosmosdb-emulator" -MsiName "AzureCosmosDBEmulator.msi"
$InstallerName = "AzureCosmosDBEmulator.msi"
$InstallerUrl = "https://aka.ms/cosmosdb-emulator"
Install-Binary -Url $InstallerUrl -Name $InstallerName

View File

@@ -6,8 +6,8 @@
Import-Module -Name ImageHelpers -Force;
$ChromeInstallerFile = "chrome_installer.exe";
$ChromeInstallerUri = "https://dl.google.com/chrome/install/375.126/${ChromeInstallerFile}";
Install-Exe -Url $ChromeInstallerUri -Name $ChromeInstallerFile -ArgumentList ("/silent", "/install")
$ChromeInstallerUrl = "https://dl.google.com/chrome/install/375.126/${ChromeInstallerFile}";
Install-Binary -Url $ChromeInstallerUrl -Name $ChromeInstallerFile -ArgumentList ("/silent", "/install")
Write-Host "Adding the firewall rule for Google update blocking";
New-NetFirewallRule -DisplayName "BlockGoogleUpdate" -Direction Outbound -Action Block -Program "C:\Program Files (x86)\Google\Update\GoogleUpdate.exe";

View File

@@ -5,6 +5,7 @@
Import-Module -Name ImageHelpers -Force
$exitcode = Install-MSI -MsiUrl "https://download.microsoft.com/download/f/1/9/f19eaee6-0728-4a0b-9755-9808acc8af0b/EN/x64/DacFramework.msi" -MsiName "DacFramework.msi"
$InstallerName = "DacFramework.msi"
$InstallerUrl = "https://download.microsoft.com/download/f/1/9/f19eaee6-0728-4a0b-9755-9808acc8af0b/EN/x64/${InstallerName}"
exit $exitcode
Install-Binary -Url $InstallerUrl -Name $InstallerName

View File

@@ -14,7 +14,7 @@ Write-Host "Firefox latest version: $latestVersion"
# url for latest version of firefox
$urlLatestVersion = "https://download.mozilla.org/?product=firefox-${latestVersion}&os=win64&lang=en-US"
Install-EXE -Url $urlLatestVersion -Name "Firefox Setup $latestVersion.exe" -ArgumentList ("/silent", "/install")
Install-Binary -Url $urlLatestVersion -Name "Firefox Setup $latestVersion.exe" -ArgumentList ("/silent", "/install")
# Disable autoupdate
$firefoxDirectoryPath = Join-Path $env:ProgramFiles "Mozilla Firefox"

View File

@@ -19,18 +19,18 @@ $gitVersion = getSimpleValue -url "https://gitforwindows.org/latest-version.txt"
$installerFile = "Git-$gitVersion-64-bit.exe";
$downloadUrl = "https://github.com/git-for-windows/git/releases/download/$gitTag/$installerFile";
Install-Exe -Url $downloadUrl `
-Name $installerFile `
-ArgumentList (
"/VERYSILENT", `
"/NORESTART", `
"/NOCANCEL", `
"/SP-", `
"/CLOSEAPPLICATIONS", `
"/RESTARTAPPLICATIONS", `
"/o:PathOption=CmdTools", `
"/o:BashTerminalOption=ConHost", `
"/COMPONENTS=gitlfs")
Install-Binary -Url $downloadUrl `
-Name $installerFile `
-ArgumentList (
"/VERYSILENT", `
"/NORESTART", `
"/NOCANCEL", `
"/SP-", `
"/CLOSEAPPLICATIONS", `
"/RESTARTAPPLICATIONS", `
"/o:PathOption=CmdTools", `
"/o:BashTerminalOption=ConHost", `
"/COMPONENTS=gitlfs")
Choco-Install -PackageName hub

View File

@@ -5,12 +5,14 @@
Import-Module -Name ImageHelpers -Force
$CondaDestination = "C:\Miniconda"
# Lock to Miniconda 4.6 until we do the work to run `conda init` for the vsts user
# Then we can go back to installing the latest Miniconda
# $url = "https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe"
$url = "https://repo.continuum.io/miniconda/Miniconda3-4.6.14-Windows-x86_64.exe"
$name = $Url.Split('/')[-1]
$destination = "C:\Miniconda"
$InstallerName = "Miniconda3-4.6.14-Windows-x86_64.exe"
$InstallerUrl = "https://repo.continuum.io/miniconda/${InstallerName}"
$ArgumentList = ("/S", "/AddToPath=0", "/RegisterPython=0", "/D=$CondaDestination")
Install-EXE -Url $url -Name $name -ArgumentList "/S /AddToPath=0 /RegisterPython=0 /D=$destination"
Set-SystemVariable -SystemVariable "CONDA" -Value $destination
Install-Binary -Url $InstallerUrl -Name $InstallerName -ArgumentList $ArgumentList
Set-SystemVariable -SystemVariable "CONDA" -Value $CondaDestination

View File

@@ -9,31 +9,23 @@ $uri = 'https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.21-winx64.zip'
$mysqlPath = 'C:\mysql-5.7.21-winx64\bin'
# Installing visual c++ redistibutable package.
$InstallerURI = 'https://download.microsoft.com/download/0/5/6/056dcda9-d667-4e27-8001-8a0c6971d6b1/vcredist_x64.exe'
$InstallerName = 'vcredist_x64.exe'
$ArgumentList = ('/install', '/quiet', '/norestart' )
$InstallerName = "vcredist_x64.exe"
$InstallerURI = "https://download.microsoft.com/download/0/5/6/056dcda9-d667-4e27-8001-8a0c6971d6b1/${InstallerName}"
$ArgumentList = ("/install", "/quiet", "/norestart")
$exitCode = Install-EXE -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList
if ($exitCode -eq 0 -or $exitCode -eq 3010)
{
# MySQL disabled TLS 1.0 support on or about Jul-14-2018. Need to make sure TLS 1.2 is enabled.
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"
Install-Binary -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList
# Get the latest mysql command line tools .
Invoke-WebRequest -UseBasicParsing -Uri $uri -OutFile mysql.zip
# MySQL disabled TLS 1.0 support on or about Jul-14-2018. Need to make sure TLS 1.2 is enabled.
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"
# Expand the zip
Expand-Archive -Path mysql.zip -DestinationPath "C:\" -Force
# Get the latest mysql command line tools .
Invoke-WebRequest -UseBasicParsing -Uri $uri -OutFile mysql.zip
# Deleting zip folder
Remove-Item -Recurse -Force mysql.zip
# Expand the zip
Expand-Archive -Path mysql.zip -DestinationPath "C:\" -Force
# Adding mysql in system environment path
Add-MachinePathItem $mysqlPath
# Deleting zip folder
Remove-Item -Recurse -Force mysql.zip
return 0;
}
else
{
return $exitCode;
}
# Adding mysql in system environment path
Add-MachinePathItem $mysqlPath

View File

@@ -6,8 +6,8 @@
Import-Module -Name ImageHelpers -Force
# .NET 4.7.2 Dev pack
$InstallerURI = "https://download.microsoft.com/download/3/B/F/3BFB9C35-405D-45DF-BDAF-0EB57D047888/NDP472-DevPack-ENU.exe"
$InstallerName = "NDP472-DevPack-ENU.exe"
$InstallerUrl = "https://download.microsoft.com/download/3/B/F/3BFB9C35-405D-45DF-BDAF-0EB57D047888/${InstallerName}"
$ArgumentList = ('Setup', '/passive', '/norestart' )
Install-EXE -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList
Install-Binary -Url $InstallerUrl -Name $InstallerName -ArgumentList $ArgumentList

View File

@@ -6,8 +6,8 @@
Import-Module -Name ImageHelpers -Force
# .NET 4.8 Dev pack
$InstallerURI = "https://download.visualstudio.microsoft.com/download/pr/014120d7-d689-4305-befd-3cb711108212/0307177e14752e359fde5423ab583e43/ndp48-devpack-enu.exe"
$InstallerName = "NDP48-DevPack-ENU.exe"
$ArgumentList = ('Setup', '/passive', '/norestart' )
$InstallerName = "ndp48-devpack-enu.exe"
$InstallerUrl = "https://download.visualstudio.microsoft.com/download/pr/014120d7-d689-4305-befd-3cb711108212/0307177e14752e359fde5423ab583e43/${InstallerName}"
$ArgumentList = ("Setup", "/passive", "/norestart")
Install-EXE -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList
Install-Binary -Url $InstallerUrl -Name $InstallerName -ArgumentList $ArgumentList

View File

@@ -7,7 +7,7 @@
Import-Module -Name ImageHelpers -Force
if(Test-IsWin19)
if (Test-IsWin19)
{
$winSdkUrl = "https://go.microsoft.com/fwlink/p/?linkid=2083338"
$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2085767"
@@ -22,24 +22,13 @@ else
$VSver = "2017"
}
$argumentList = ("/features", "+", "/quiet")
# `winsdksetup.exe /features + /quiet` installs all features without showing the GUI
$sdkExitCode = Install-EXE -Url $winSdkUrl -Name "winsdksetup.exe" -ArgumentList ("/features", "+", "/quiet")
if ($sdkExitCode -ne 0)
{
Write-Host "Failed to install the Windows SDK."
exit $sdkExitCode
}
Install-Binary -Url $winSdkUrl -Name "winsdksetup.exe" -ArgumentList $argumentList
# `wdksetup.exe /features + /quiet` installs all features without showing the GUI
$wdkExitCode = Install-EXE -Url $wdkUrl -Name "wdksetup.exe" -ArgumentList ("/features", "+", "/quiet")
if ($wdkExitCode -ne 0)
{
Write-Host "Failed to install the Windows Driver Kit."
exit $wdkExitCode
}
Install-Binary -Url $wdkUrl -Name "wdksetup.exe" -ArgumentList $argumentList
# Need to install the VSIX to get the build targets when running VSBuild
Install-VsixExtension -FilePath $FilePath -Name "WDK.vsix" -VSversion $VSver -InstallOnly

View File

@@ -4,5 +4,9 @@
####################################################################################
Import-Module -Name ImageHelpers -Force
$InstallerName = "WindowsApplicationDriver.msi"
$InstallerUrl = "https://github.com/Microsoft/WinAppDriver/releases/download/v1.1/${InstallerName}"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-MSI -MsiUrl "https://github.com/Microsoft/WinAppDriver/releases/download/v1.1/WindowsApplicationDriver.msi" -MsiName "WindowsApplicationDriver.msi"
Install-Binary -Url $InstallerUrl -Name $InstallerName

View File

@@ -7,18 +7,13 @@ Import-Module -Name ImageHelpers -Force
#SSDT for Visual Studio 2017
#The link down below points to the latest version of SSDT for Visual Studio 2017
$InstallerURI = 'https://go.microsoft.com/fwlink/?linkid=2124518'
$InstallerName = 'SSDT-Setup-ENU.exe'
$InstallerName = "SSDT-Setup-ENU.exe"
$InstallerUrl = "https://go.microsoft.com/fwlink/?linkid=2124518"
$logFilePath = "$env:TEMP\ssdtlog.txt"
$ArgumentList = ('/install', 'INSTALLALL', '/passive', '/norestart', "/log `"$logFilePath`"")
$ArgumentList = ("/install", "INSTALLALL", "/passive", "/norestart", "/log `"$logFilePath`"")
$exitCode = Install-EXE -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList
Install-Binary -Url $InstallerUrl -Name $InstallerName -ArgumentList $ArgumentList
if($exitCode -ne 0 -and $exitCode -ne 3010)
{
Write-Host "******** SSDT SETUP LOG START ********"
Write-Host $(Get-Content $logFilePath | Out-String)
Write-Host "******** SSDT SETUP LOG END ********"
}
exit $exitCode
Write-Host "******** SSDT SETUP LOG START ********"
Write-Host $(Get-Content $logFilePath | Out-String)
Write-Host "******** SSDT SETUP LOG END ********"

View File

@@ -5,10 +5,8 @@
Import-Module -Name ImageHelpers -Force
$InstallerURI = 'http://download.microsoft.com/download/B/0/C/B0C80BA3-8AD6-4958-810B-6882485230B5/standalonesdk/sdksetup.exe'
$InstallerName = 'sdksetup.exe'
$ArgumentList = ('/quiet', '/norestart')
$InstallerName = "sdksetup.exe"
$InstallerUrl = "http://download.microsoft.com/download/B/0/C/B0C80BA3-8AD6-4958-810B-6882485230B5/standalonesdk/${InstallerName}"
$ArgumentList = ("/quiet", "/norestart")
$exitCode = Install-EXE -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList
exit $exitCode
Install-Binary -Url $InstallerUrl -Name $InstallerName -ArgumentList $ArgumentList