[Windows] Az Modules Size Reduction On Image (#2827)

* [Windows] Az Modules Size Reduction On Image

* Addressing review comments

* Downloading azure and azurerm from blob storage
This commit is contained in:
Amruta Kawade
2021-03-26 20:51:12 +05:30
committed by GitHub
parent 4c606d887d
commit f6f2e3681e
3 changed files with 70 additions and 12 deletions

View File

@@ -36,6 +36,46 @@ foreach ($module in $modules)
}
}
if($null -ne $module.url)
{
$assets = Invoke-RestMethod $module.url
}
foreach ($version in $module.zip_versions)
{
# Install modules from GH Release
if($null -ne $assets)
{
$asset = $assets | Where-Object version -eq $version `
| Select-Object -ExpandProperty files `
| Select-Object -First 1
Write-Host "Installing $($module.name) $version ..."
if ($null -ne $asset) {
Start-DownloadWithRetry -Url $asset.download_url -Name $asset.filename -DownloadPath $installPSModulePath
} else {
Write-Host "Asset was not found in versions manifest"
exit 1
}
}
# Install modules from vsts blob
else
{
$modulePath = Join-Path -Path $installPSModulePath -ChildPath "${moduleName}_${version}"
$filename = "${moduleName}_${version}.zip"
$download_url = [System.String]::Concat($module.blob_url,$filename)
Write-Host " - $version [$modulePath]"
try
{
Start-DownloadWithRetry -Url $download_url -Name $filename -DownloadPath $installPSModulePath
}
catch
{
Write-Host "Error: $_"
exit 1
}
}
}
# Append default tool version to machine path
if ($null -ne $module.default)
{