mirror of
https://github.com/actions/runner-images.git
synced 2026-01-13 22:51:51 +08:00
[Ubuntu, Windows] Add Azure modules to PS scope; deprecate zip (#13482)
This commit is contained in:
@@ -11,6 +11,7 @@ Import-Module "$env:HELPER_SCRIPTS/../tests/Helpers.psm1"
|
||||
# Get modules content from toolset
|
||||
$modules = (Get-ToolsetContent).azureModules
|
||||
$installPSModulePath = "/usr/share"
|
||||
$psModuleMachinePath = $env:PSModulePath + ":"
|
||||
|
||||
foreach ($module in $modules) {
|
||||
$moduleName = $module.name
|
||||
@@ -19,9 +20,12 @@ foreach ($module in $modules) {
|
||||
foreach ($version in $module.versions) {
|
||||
$modulePath = Join-Path -Path $installPSModulePath -ChildPath "${moduleName}_${version}"
|
||||
Write-Host " - $version [$modulePath]"
|
||||
$psModuleMachinePath += ($modulePath + ":")
|
||||
Save-Module -Path $modulePath -Name $moduleName -RequiredVersion $version -Force
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$finalLine = "PSModulePath=$($psModuleMachinePath.TrimEnd(':').Replace("\root", '$HOME'))"
|
||||
Add-Content -Path "/etc/environment" -Value $finalLine
|
||||
|
||||
Invoke-PesterTests -TestFile "PowerShellModules" -TestName "AzureModules"
|
||||
|
||||
Reference in New Issue
Block a user