diff --git a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 index 3f10d70b..e95c10be 100644 --- a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 +++ b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 @@ -21,6 +21,7 @@ Export-ModuleMember -Function @( 'Stop-SvcWithErrHandling' 'Set-SvcWithErrHandling' 'Start-DownloadWithRetry' + 'Get-VsixExtenstionFromMarketplace' 'Install-VsixExtension' 'Get-VSExtensionVersion' 'Get-WinVersion' diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 index 225b99ff..ac55d9cf 100644 --- a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -198,6 +198,33 @@ function Start-DownloadWithRetry return $filePath } +function Get-VsixExtenstionFromMarketplace { + Param + ( + [string] $ExtensionMarketPlaceName, + [string] $MarketplaceUri = "https://marketplace.visualstudio.com/items?itemName=" + ) + + $extensionUri = $MarketplaceUri + $ExtensionMarketPlaceName + $request = Invoke-WebRequest -Uri $extensionUri -UseBasicParsing + $request -match 'UniqueIdentifierValue":"(?[^"]*)' | Out-Null + $extensionName = $Matches.extensionname + $request -match 'VsixId":"(?[^"]*)' | Out-Null + $vsixId = $Matches.vsixid + $request -match 'AssetUri":"(?[^"]*)' | Out-Null + $assetUri = $Matches.uri + $request -match 'Microsoft\.VisualStudio\.Services\.Payload\.FileName":"(?[^"]*)' | Out-Null + $fileName = $Matches.filename + $downloadUri = $assetUri + "/" + $fileName + + return [PSCustomObject] @{ + "ExtensionName" = $extensionName + "VsixId" = $vsixId + "FileName" = $fileName + "DownloadUri" = $downloadUri + } +} + function Install-VsixExtension { Param diff --git a/images/win/scripts/Installers/Install-Vsix.ps1 b/images/win/scripts/Installers/Install-Vsix.ps1 index 628b643b..23d75729 100644 --- a/images/win/scripts/Installers/Install-Vsix.ps1 +++ b/images/win/scripts/Installers/Install-Vsix.ps1 @@ -12,7 +12,9 @@ if (-not $vsixPackagesList) { $vsVersion = $toolset.visualStudio.Version $vsixPackagesList | ForEach-Object { - Install-VsixExtension -Url $_.url -Name $_.name -VSversion $vsVersion + # Retrieve cdn endpoint to avoid HTTP error 429 https://github.com/actions/virtual-environments/issues/3074 + $vsixPackage = Get-VsixExtenstionFromMarketplace -ExtensionMarketPlaceName $_ + Install-VsixExtension -Url $vsixPackage.DownloadUri -Name $vsixPackage.FileName -VSversion $vsVersion } Invoke-PesterTests -TestFile "Vsix" \ No newline at end of file diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 index 0004c168..576a8e13 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.VisualStudio.psm1 @@ -20,6 +20,21 @@ function Get-WDKVersion { } function Get-VisualStudioExtensions { + # Additional vsixs + $toolset = Get-ToolsetContent + $vsixUrls = $toolset.visualStudio.vsix + if ($vsixUrls) + { + $vsixs = $vsixUrls | ForEach-Object { + $vsix = Get-VsixExtenstionFromMarketplace -ExtensionMarketPlaceName $_ + $vsixVersion = (Get-VisualStudioPackages | Where-Object {$_.Id -match $vsix.VsixId -and $_.type -eq 'vsix'}).Version + @{ + Package = $vsix.ExtensionName + Version = $vsixVersion + } + } + } + # Wix $vs = (Get-VisualStudioVersion).Name.Split()[-1] $wixPackageVersion = Get-WixVersion @@ -29,18 +44,9 @@ function Get-VisualStudioExtensions { $wdkPackageVersion = Get-VSExtensionVersion -packageName 'Microsoft.Windows.DriverKit' $wdkExtensionVersion = Get-WDKVersion - # SSDT - $analysisPackageVersion = Get-VSExtensionVersion -packageName '04a86fc2-dbd5-4222-848e-911638e487fe' - $reportingPackageVersion = Get-VSExtensionVersion -packageName '717ad572-c4b7-435c-c166-c2969777f718' - - $integrationPackageName = ($vs -match "2019") ? '851E7A09-7B2B-4F06-A15D-BABFCB26B970' : 'D1B09713-C12E-43CC-9EF4-6562298285AB' - $integrationPackageVersion = Get-VSExtensionVersion -packageName $integrationPackageName - $extensions = @( - @{Package = 'SSDT Microsoft Analysis Services Projects'; Version = $analysisPackageVersion} - @{Package = 'SSDT SQL Server Integration Services Projects'; Version = $integrationPackageVersion} - @{Package = 'SSDT Microsoft Reporting Services Projects'; Version = $reportingPackageVersion} - @{Package = 'Windows Driver Kit'; Version = $wixPackageVersion} + $vsixs + @{Package = 'Windows Driver Kit'; Version = $wdkPackageVersion} @{Package = 'Windows Driver Kit Visual Studio Extension'; Version = $wdkExtensionVersion} @{Package = 'WIX Toolset'; Version = $wixPackageVersion} @{Package = "WIX Toolset Studio $vs Extension"; Version = $wixExtensionVersion} @@ -48,5 +54,5 @@ function Get-VisualStudioExtensions { $extensions | Foreach-Object { [PSCustomObject]$_ - } | Select-Object Package, Version + } | Select-Object Package, Version | Sort-Object Package } \ No newline at end of file diff --git a/images/win/scripts/Tests/Vsix.Tests.ps1 b/images/win/scripts/Tests/Vsix.Tests.ps1 index b92f862e..69e66823 100644 --- a/images/win/scripts/Tests/Vsix.Tests.ps1 +++ b/images/win/scripts/Tests/Vsix.Tests.ps1 @@ -3,9 +3,16 @@ Describe "Vsix" { $requiredVsixs = $toolset.visualStudio.vsix $allPackages = (Get-VSSetupInstance | Select-VsSetupInstance -Product *).Packages - $testCases = $requiredVsixs | ForEach-Object { @{ VsixId = $_.Id; AllPackages = $allPackages }} + $testCases = $requiredVsixs | ForEach-Object { + $vsix = Get-VsixExtenstionFromMarketplace -ExtensionMarketPlaceName $_ + @{ + VsixName = $vsix.ExtensionName + VsixId = $vsix.VsixId + AllPackages = $allPackages + } + } if ($testCases.Count -gt 0) { - It "Extension " -TestCases $testCases { + It "Extension is installed" -TestCases $testCases { $objVsix = $AllPackages | Where-Object { $_.id -eq $VsixId } $objVsix | Should -Not -BeNullOrEmpty } diff --git a/images/win/toolsets/toolset-2019.json b/images/win/toolsets/toolset-2019.json index 3a95d10f..215c8082 100644 --- a/images/win/toolsets/toolset-2019.json +++ b/images/win/toolsets/toolset-2019.json @@ -270,31 +270,11 @@ "Component.MDD.Linux.GCC.arm" ], "vsix": [ - { - "name": "Microsoft.DataTools.AnalysisServices.vsix", - "url": "https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ProBITools/vsextensions/MicrosoftAnalysisServicesModelingProjects/2.9.5/vspackage", - "id": "04a86fc2-dbd5-4222-848e-911638e487fe" - }, - { - "name": "Microsoft.DataTools.IntegrationServices.exe", - "url": "https://marketplace.visualstudio.com/_apis/public/gallery/publishers/SSIS/vsextensions/SqlServerIntegrationServicesProjects/3.4/vspackage", - "id": "851E7A09-7B2B-4F06-A15D-BABFCB26B970" - }, - { - "name": "Microsoft.DataTools.ReportingServices.vsix", - "url": "https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ProBITools/vsextensions/MicrosoftReportProjectsforVisualStudio/2.6.3/vspackage", - "id": "717ad572-c4b7-435c-c166-c2969777f718" - }, - { - "name": "Microsoft.VisualStudio.Installer.Projects.vsix", - "url": "https://marketplace.visualstudio.com/_apis/public/gallery/publishers/VisualStudioClient/vsextensions/MicrosoftVisualStudio2017InstallerProjects/latest/vspackage", - "id": "VSInstallerProjects" - }, - { - "name": "BizTalkVsix.vsix", - "url": "https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-biztalk/vsextensions/BizTalk/3.13.2.0/vspackage", - "id": "BizTalkProjectSystem.BD1D0FA0-E48A-4270-995F-F110DD9F7838" - } + "ProBITools.MicrosoftAnalysisServicesModelingProjects", + "SSIS.SqlServerIntegrationServicesProjects", + "ProBITools.MicrosoftReportProjectsforVisualStudio", + "VisualStudioClient.MicrosoftVisualStudio2017InstallerProjects", + "ms-biztalk.BizTalk" ] }, "docker": {