mirror of
https://github.com/actions/runner-images.git
synced 2025-12-13 20:56:47 +00:00
[ubuntu] Rename build scripts (#8866)
* [ubuntu] Rename build scripts * [ubuntu] Change reboot to inline shell * [ubuntu] Move disk space validation to pester tests * [ubuntu] Rename helper and tests files * [ubuntu] Changes to cleanup, post-deployment and r scripts
This commit is contained in:
committed by
GitHub
parent
410fd620be
commit
1bd9214f41
45
images/ubuntu/scripts/build/Install-PowerShellAzModules.ps1
Normal file
45
images/ubuntu/scripts/build/Install-PowerShellAzModules.ps1
Normal file
@@ -0,0 +1,45 @@
|
||||
################################################################################
|
||||
## File: Install-PowerShellAzModules.ps1
|
||||
## Desc: Install Az modules for PowerShell
|
||||
################################################################################
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$ProgressPreference = "SilentlyContinue"
|
||||
|
||||
Import-Module "$env:HELPER_SCRIPTS/../tests/Helpers.psm1" -DisableNameChecking
|
||||
|
||||
# Get modules content from toolset
|
||||
$modules = (Get-ToolsetContent).azureModules
|
||||
$installPSModulePath = "/usr/share"
|
||||
|
||||
foreach ($module in $modules)
|
||||
{
|
||||
$moduleName = $module.name
|
||||
Write-Host "Installing ${moduleName} to the ${installPSModulePath} path..."
|
||||
foreach ($version in $module.versions)
|
||||
{
|
||||
$modulePath = Join-Path -Path $installPSModulePath -ChildPath "${moduleName}_${version}"
|
||||
Write-Host " - $version [$modulePath]"
|
||||
Save-Module -Path $modulePath -Name $moduleName -RequiredVersion $version -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