[Linux] Az Modules Size Reduction On Image (#2828)

* [Linux] Az Modules Size Reduction On Image

* addressing review comments

* addressing review comments

* Addressing review comments
This commit is contained in:
Amruta Kawade
2021-03-25 12:04:25 +05:30
committed by GitHub
parent ff9f3f0a8b
commit 5545084098
4 changed files with 33 additions and 32 deletions

View File

@@ -17,15 +17,24 @@ foreach ($module in $modules)
Write-Host " - $version [$modulePath]"
Save-Module -Path $modulePath -Name $moduleName -RequiredVersion $version -Force -Verbose
}
}
# If Az.Accounts > 1.0.0 unable to load module with error: Assembly with same name is already loaded
# Force install Az.Accounts 1.0.0
$azAccountsPath = "/usr/share/az_1.0.0/Az.Accounts"
if (Test-Path $azAccountsPath)
{
Remove-Item -Path $azAccountsPath -Force -Recurse
Save-Module -Name Az.Accounts -Path "/usr/share/az_1.0.0" -RequiredVersion 1.0.0 -Force
$assets = Invoke-RestMethod $module.url
# Get github release asset for each version
foreach ($toolVersion in $module.zip_versions) {
$asset = $assets | Where-Object version -eq $toolVersion `
| Select-Object -ExpandProperty files `
| Select-Object -First 1
Write-Host "Installing $($module.name) $toolVersion ..."
if ($null -ne $asset) {
Write-Host "Download $($asset.filename)"
wget $asset.download_url -nv --retry-connrefused --tries=10 -P $installPSModulePath
} else {
Write-Host "Asset was not found in versions manifest"
exit 1
}
}
}
Invoke-PesterTests -TestFile "PowerShellModules" -TestName "AzureModules"

View File

@@ -109,19 +109,13 @@
"azureModules": [
{
"name": "az",
"url" : "https://raw.githubusercontent.com/Azure/az-ps-module-versions/main/versions-manifest.json",
"versions": [
"1.0.0",
"1.6.0",
"2.3.2",
"2.6.0",
"2.8.0",
"5.5.0"
],
"zip_versions": [
"3.1.0",
"3.5.0",
"3.8.0",
"4.3.0",
"4.4.0",
"4.6.0",
"4.7.0"
"4.4.0"
]
}
],

View File

@@ -105,19 +105,13 @@
"azureModules": [
{
"name": "az",
"url" : "https://raw.githubusercontent.com/Azure/az-ps-module-versions/main/versions-manifest.json",
"versions": [
"1.0.0",
"1.6.0",
"2.3.2",
"2.6.0",
"2.8.0",
"5.5.0"
],
"zip_versions": [
"3.1.0",
"3.5.0",
"3.8.0",
"4.3.0",
"4.4.0",
"4.6.0",
"4.7.0"
"4.4.0"
]
}
],

View File

@@ -103,9 +103,13 @@
"azureModules": [
{
"name": "az",
"url" : "https://raw.githubusercontent.com/Azure/az-ps-module-versions/main/versions-manifest.json",
"versions": [
"3.8.0",
"4.8.0"
"5.5.0"
],
"zip_versions": [
"3.1.0",
"4.4.0"
]
}
],