mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-30 21:38:26 +08:00
[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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user