Improve Windows Visual Studio provisioners (#758)

* Add retries to DotnetSDK provisioner

* Improve VS provisioners

* Fixes in syntax

* Fixes in syntax

* Rename Install-VS function

* Remove bootstrapperName parameter from Install-VisualStudio

* Small fix
This commit is contained in:
Maksim Petrov
2020-05-05 20:50:00 +03:00
committed by GitHub
parent 33f6bf1309
commit 3fba9caa4f
5 changed files with 111 additions and 155 deletions

View File

@@ -32,7 +32,10 @@ function InstallSDKVersion (
}
# Fix for issue 1276. This will be fixed in 3.1.
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/dotnet/sdk/82bc30c99f1325dfaa7ad450be96857a4fca2845/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.ImportPublishProfile.targets" -outfile "C:\Program Files\dotnet\sdk\$sdkVersion\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportPublishProfile.targets"
$sdkTargetsName = "Microsoft.NET.Sdk.ImportPublishProfile.targets"
$sdkTargetsUrl = "https://raw.githubusercontent.com/dotnet/sdk/82bc30c99f1325dfaa7ad450be96857a4fca2845/src/Tasks/Microsoft.NET.Build.Tasks/targets/${sdkTargetsName}"
$sdkTargetsPath = "C:\Program Files\dotnet\sdk\$sdkVersion\Sdks\Microsoft.NET.Sdk\targets"
Start-DownloadWithRetry -Url $sdkTargetsUrl -DownloadPath $sdkTargetsPath -Name $sdkTargetsName
# warm up dotnet for first time experience
$templates | ForEach-Object {
@@ -49,8 +52,10 @@ function InstallSDKVersion (
function InstallAllValidSdks()
{
Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json' -UseBasicParsing -OutFile 'releases-index.json'
$dotnetChannels = Get-Content -Path 'releases-index.json' | ConvertFrom-Json
$releaseIndexName = "releases-index.json"
$releaseIndexUrl = "https://raw.githubusercontent.com/dotnet/core/master/release-notes/${releaseIndexName}"
$releasesIndexPath = Start-DownloadWithRetry -Url $releaseIndexUrl -Name $releaseIndexName
$dotnetChannels = Get-Content -Path $releasesIndexPath | ConvertFrom-Json
# Consider all channels except preview/eol channels.
# Sort the channels in ascending order
@@ -58,13 +63,15 @@ function InstallAllValidSdks()
$dotnetChannels = $dotnetChannels.'releases-index' | Where-Object { (!$_."support-phase".Equals('preview') -and !$_."support-phase".Equals('eol')) -or ($_."channel-version" -eq "2.2") } | Sort-Object { [Version] $_."channel-version" }
# Download installation script.
Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.ps1' -UseBasicParsing -OutFile 'dotnet-install.ps1'
$installationName = "dotnet-install.ps1"
$installationUrl = "https://dot.net/v1/${installationName}"
Start-DownloadWithRetry -Url $installationUrl -Name $installationName -DownloadPath ".\"
ForEach ($dotnetChannel in $dotnetChannels)
{
$channelVersion = $dotnetChannel.'channel-version';
Invoke-WebRequest -Uri $dotnetChannel.'releases.json' -UseBasicParsing -OutFile "releases-$channelVersion.json"
$currentReleases = Get-Content -Path "releases-$channelVersion.json" | ConvertFrom-Json
$releasesJsonPath = Start-DownloadWithRetry -Url $dotnetChannel.'releases.json' -Name "releases-$channelVersion.json"
$currentReleases = Get-Content -Path $releasesJsonPath | ConvertFrom-Json
# filtering out the preview/rc releases
$currentReleases = $currentReleases.'releases' | Where-Object { !$_.'release-version'.Contains('-') } | Sort-Object { [Version] $_.'release-version' }
@@ -74,7 +81,6 @@ function InstallAllValidSdks()
{
Write-Host 'Found sdks property in release: ' + $release.'release-version' + 'with sdks count: ' + $release.'sdks'.Count
# Remove duplicate entries & preview/rc version from download list
# Sort the sdks on version
$sdks = @($release.'sdk');