mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
* Install and validate AZ 4.3.0 for Windows images * Move azureModules to toolset * Fix validation * Fix modules root location * Small fix in syntax * Fix in syntax * Fixes for default tool versions
44 lines
1.3 KiB
PowerShell
44 lines
1.3 KiB
PowerShell
################################################################################
|
|
## File: Validate-AzureModules.ps1
|
|
## Desc: Validate Azure PowerShell modules
|
|
################################################################################
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$modulesRootPath = $env:PSMODULES_ROOT_FOLDER
|
|
|
|
# Get modules content from toolset
|
|
$modules = (Get-ToolsetContent).azureModules
|
|
|
|
foreach ($module in $modules)
|
|
{
|
|
foreach ($version in $module.versions)
|
|
{
|
|
$moduleName = $module.name
|
|
$modulePath = Join-Path -Path $modulesRootPath -ChildPath "$($module.name)_${version}"
|
|
|
|
Write-Host "Trying to import ${moduleName}_${version}..."
|
|
$testJob = Start-Job -ScriptBlock {
|
|
param (
|
|
$modulePath,
|
|
$moduleName
|
|
)
|
|
|
|
$env:PsModulePath = "$modulePath;$env:PsModulePath"
|
|
Import-Module -Name $moduleName
|
|
Get-Module -Name $moduleName
|
|
|
|
} -ArgumentList $modulePath, $moduleName
|
|
|
|
$isError = $testJob | Wait-Job | Foreach-Object ChildJobs | Where-Object { $_.Error }
|
|
if ($isError)
|
|
{
|
|
Write-Host "Required ${moduleName} module ${version} version is not present"
|
|
|
|
exit 1
|
|
}
|
|
|
|
$testJob | Receive-Job | Select-Object Name,Version,Path
|
|
Remove-Job $testJob
|
|
}
|
|
} |