From 325070bdee127bc57c5943f14c27a70f5d73335b Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov Date: Tue, 10 Nov 2020 01:15:37 +0300 Subject: [PATCH 1/4] install dotnet 5.0 and rework installation logic --- images/win/scripts/Installers/Install-DotnetSDK.ps1 | 13 ++++--------- images/win/toolsets/toolset-2016.json | 10 +++++++++- images/win/toolsets/toolset-2019.json | 9 ++++++++- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/images/win/scripts/Installers/Install-DotnetSDK.ps1 b/images/win/scripts/Installers/Install-DotnetSDK.ps1 index 7b91c7ac..12b4a701 100644 --- a/images/win/scripts/Installers/Install-DotnetSDK.ps1 +++ b/images/win/scripts/Installers/Install-DotnetSDK.ps1 @@ -55,24 +55,19 @@ function InstallSDKVersion ( function InstallAllValidSdks() { - $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 - $dotnetChannels = $dotnetChannels.'releases-index' | Where-Object { (!$_."support-phase".Equals('preview') -and !$_."support-phase".Equals('eol') -and !$_."support-phase".Equals('rc')) } | Sort-Object { [Version] $_."channel-version" } + $dotnetVersions = (Get-ToolsetContent).dotnet.versions # Download installation script. $installationName = "dotnet-install.ps1" $installationUrl = "https://dot.net/v1/${installationName}" Start-DownloadWithRetry -Url $installationUrl -Name $installationName -DownloadPath ".\" - ForEach ($dotnetChannel in $dotnetChannels) + ForEach ($dotnetVersion in $dotnetVersions) { - $channelVersion = $dotnetChannel.'channel-version'; - $releasesJsonPath = Start-DownloadWithRetry -Url $dotnetChannel.'releases.json' -Name "releases-$channelVersion.json" + $releaseJson = "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/${dotnetVersion}/releases.json" + $releasesJsonPath = Start-DownloadWithRetry -Url $releaseJson -Name "releases-${dotnetVersion}.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' } diff --git a/images/win/toolsets/toolset-2016.json b/images/win/toolsets/toolset-2016.json index f5d30694..e612645b 100644 --- a/images/win/toolsets/toolset-2016.json +++ b/images/win/toolsets/toolset-2016.json @@ -243,5 +243,13 @@ "package": "yamllint", "cmd": "yamllint --version" } - ] + ], + "dotnet": { + "versions": [ + "1.1", + "2.1", + "3.1", + "5.0" + ] + } } diff --git a/images/win/toolsets/toolset-2019.json b/images/win/toolsets/toolset-2019.json index ebb7aa82..94e0f93c 100644 --- a/images/win/toolsets/toolset-2019.json +++ b/images/win/toolsets/toolset-2019.json @@ -286,5 +286,12 @@ "package": "yamllint", "cmd": "yamllint --version" } - ] + ], + "dotnet": { + "versions": [ + "2.1", + "3.1", + "5.0" + ] + } } From caa872685a9d06e66d9368a40755faa3ce5791c1 Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov Date: Tue, 10 Nov 2020 15:50:34 +0300 Subject: [PATCH 2/4] resolve issues --- images/win/toolsets/toolset-2016.json | 3 +-- images/win/toolsets/toolset-2019.json | 3 +-- images/win/windows2016.json | 3 +++ images/win/windows2019.json | 3 +++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/images/win/toolsets/toolset-2016.json b/images/win/toolsets/toolset-2016.json index e612645b..e9ec9116 100644 --- a/images/win/toolsets/toolset-2016.json +++ b/images/win/toolsets/toolset-2016.json @@ -248,8 +248,7 @@ "versions": [ "1.1", "2.1", - "3.1", - "5.0" + "3.1" ] } } diff --git a/images/win/toolsets/toolset-2019.json b/images/win/toolsets/toolset-2019.json index 94e0f93c..2b226ab7 100644 --- a/images/win/toolsets/toolset-2019.json +++ b/images/win/toolsets/toolset-2019.json @@ -290,8 +290,7 @@ "dotnet": { "versions": [ "2.1", - "3.1", - "5.0" + "3.1" ] } } diff --git a/images/win/windows2016.json b/images/win/windows2016.json index 120e7ac9..13cdc4a7 100644 --- a/images/win/windows2016.json +++ b/images/win/windows2016.json @@ -285,6 +285,9 @@ }, { "type": "powershell", + "environment_vars": [ + "TOOLSET_JSON_PATH={{user `toolset_json_path`}}" + ], "scripts": [ "{{ template_dir }}/scripts/Installers/Install-VSWhere.ps1", "{{ template_dir }}/scripts/Installers/Install-WinAppDriver.ps1", diff --git a/images/win/windows2019.json b/images/win/windows2019.json index a27bf27d..f2c230bf 100644 --- a/images/win/windows2019.json +++ b/images/win/windows2019.json @@ -292,6 +292,9 @@ }, { "type": "powershell", + "environment_vars": [ + "TOOLSET_JSON_PATH={{user `toolset_json_path`}}" + ], "scripts": [ "{{ template_dir }}/scripts/Installers/Install-VSWhere.ps1", "{{ template_dir }}/scripts/Installers/Install-WinAppDriver.ps1", From 0dfa33bbc7d643d44fe06ab960bbeef9767cc42b Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov Date: Tue, 10 Nov 2020 20:52:28 +0300 Subject: [PATCH 3/4] remove dotnet-core 1.1 --- images/win/toolsets/toolset-2016.json | 1 - 1 file changed, 1 deletion(-) diff --git a/images/win/toolsets/toolset-2016.json b/images/win/toolsets/toolset-2016.json index e9ec9116..d041ece2 100644 --- a/images/win/toolsets/toolset-2016.json +++ b/images/win/toolsets/toolset-2016.json @@ -246,7 +246,6 @@ ], "dotnet": { "versions": [ - "1.1", "2.1", "3.1" ] From 19854dc3213fd0a93b8d3dc182fbac7b602cfe48 Mon Sep 17 00:00:00 2001 From: Dibir Magomedsaygitov Date: Wed, 11 Nov 2020 16:22:17 +0300 Subject: [PATCH 4/4] resolve issue with dotnet tests --- images/win/scripts/Tests/DotnetSDK.Tests.ps1 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/images/win/scripts/Tests/DotnetSDK.Tests.ps1 b/images/win/scripts/Tests/DotnetSDK.Tests.ps1 index 373e1d47..903be287 100644 --- a/images/win/scripts/Tests/DotnetSDK.Tests.ps1 +++ b/images/win/scripts/Tests/DotnetSDK.Tests.ps1 @@ -1,6 +1,4 @@ -$releaseIndexUrl = "https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json" -$dotnetChannels = (New-Object system.net.webclient).DownloadString($releaseIndexUrl) | ConvertFrom-Json -$dotnetVersions = $dotnetChannels.'releases-index' | Where-Object { (!$_."support-phase".Equals('preview') -and !$_."support-phase".Equals('eol') -and !$_."support-phase".Equals('rc')) } | Select-Object -ExpandProperty "channel-version" +$dotnetVersions = (Get-ToolsetContent).dotnet.versions Describe "Dotnet SDK" {