mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-14 13:56:47 +00:00
[Windows] Install vsix extensions using CDN endpoint (#3244)
* Install extensions for VS19 * Get vsix packages name in runtime * add a bit of debug * Get extension id from the marketplace uri * Add extension name * skip vcredist installation * Add Get-VsixExtenstionFromMarketplace to ImageHelpers.psm1 * Fix DownloadUri name in the function * DownloadUri in lower case * Add packages to the readme * Add a condition to software report * fix spelling in function * Simplify toolset + get rid of backticks
This commit is contained in:
@@ -21,6 +21,7 @@ Export-ModuleMember -Function @(
|
||||
'Stop-SvcWithErrHandling'
|
||||
'Set-SvcWithErrHandling'
|
||||
'Start-DownloadWithRetry'
|
||||
'Get-VsixExtenstionFromMarketplace'
|
||||
'Install-VsixExtension'
|
||||
'Get-VSExtensionVersion'
|
||||
'Get-WinVersion'
|
||||
|
||||
@@ -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":"(?<extensionname>[^"]*)' | Out-Null
|
||||
$extensionName = $Matches.extensionname
|
||||
$request -match 'VsixId":"(?<vsixid>[^"]*)' | Out-Null
|
||||
$vsixId = $Matches.vsixid
|
||||
$request -match 'AssetUri":"(?<uri>[^"]*)' | Out-Null
|
||||
$assetUri = $Matches.uri
|
||||
$request -match 'Microsoft\.VisualStudio\.Services\.Payload\.FileName":"(?<filename>[^"]*)' | Out-Null
|
||||
$fileName = $Matches.filename
|
||||
$downloadUri = $assetUri + "/" + $fileName
|
||||
|
||||
return [PSCustomObject] @{
|
||||
"ExtensionName" = $extensionName
|
||||
"VsixId" = $vsixId
|
||||
"FileName" = $fileName
|
||||
"DownloadUri" = $downloadUri
|
||||
}
|
||||
}
|
||||
|
||||
function Install-VsixExtension
|
||||
{
|
||||
Param
|
||||
|
||||
@@ -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"
|
||||
@@ -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
|
||||
}
|
||||
@@ -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 <VsixId>" -TestCases $testCases {
|
||||
It "Extension <VsixName> is installed" -TestCases $testCases {
|
||||
$objVsix = $AllPackages | Where-Object { $_.id -eq $VsixId }
|
||||
$objVsix | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user