mirror of
https://github.com/actions/runner-images.git
synced 2025-12-28 04:38:53 +08:00
[windows] warmup Azure CLI (#8427)
* [windows] warmup Azure CLI Improve Azure CLI first run timing. Follow up: https://github.com/actions/runner-images/pull/8294 Co-authored-by: Jesse Houwing <jesse.houwing@gmail.com> * expose AZURE_EXTENSION_DIR to image generation * suppress az warmup output * refresh PATH before warmup --------- Co-authored-by: Jesse Houwing <jesse.houwing@gmail.com>
This commit is contained in:
@@ -3,13 +3,33 @@
|
||||
## Desc: Install Azure CLI
|
||||
################################################################################
|
||||
|
||||
Write-Host "Install the latest Azure CLI release"
|
||||
$azCliUrl = "https://aka.ms/installazurecliwindowsx64"
|
||||
Install-Binary -Url $azCliUrl -Name "azure-cli.msi"
|
||||
Write-Host 'Install the latest Azure CLI release'
|
||||
|
||||
$azureCliConfigPath = 'C:\azureCli'
|
||||
# Store azure-cli cache outside of the provisioning user's profile
|
||||
[Environment]::SetEnvironmentVariable('AZURE_CONFIG_DIR', $azureCliConfigPath, [System.EnvironmentVariableTarget]::Machine)
|
||||
# make variable to be available in the current session
|
||||
${env:AZURE_CONFIG_DIR} = $azureCliConfigPath
|
||||
|
||||
$azCliUrl = 'https://aka.ms/installazurecliwindowsx64'
|
||||
Install-Binary -Url $azCliUrl -Name 'azure-cli.msi'
|
||||
|
||||
$azureCliExtensionPath = Join-Path $Env:CommonProgramFiles 'AzureCliExtensionDirectory'
|
||||
$null = New-Item -ItemType "Directory" -Path $azureCliExtensionPath
|
||||
$null = New-Item -ItemType 'Directory' -Path $azureCliExtensionPath
|
||||
|
||||
[Environment]::SetEnvironmentVariable("AZURE_EXTENSION_DIR", $azureCliExtensionPath, [System.EnvironmentVariableTarget]::Machine)
|
||||
[Environment]::SetEnvironmentVariable('AZURE_EXTENSION_DIR', $azureCliExtensionPath, [System.EnvironmentVariableTarget]::Machine)
|
||||
# make variable to be available in the current session
|
||||
${env:AZURE_EXTENSION_DIR} = $azureCliExtensionPath
|
||||
|
||||
Invoke-PesterTests -TestFile "CLI.Tools" -TestName "Azure CLI"
|
||||
# Warm-up Azure CLI
|
||||
|
||||
Write-Host "Warmup 'az'"
|
||||
|
||||
$env:PATH = [Environment]::GetEnvironmentVariable('PATH', 'Machine')
|
||||
az --help | Out-Null
|
||||
if ($LASTEXITCODE -ne 0)
|
||||
{
|
||||
throw "Command 'az --help' failed"
|
||||
}
|
||||
|
||||
Invoke-PesterTests -TestFile 'CLI.Tools' -TestName 'Azure CLI'
|
||||
|
||||
Reference in New Issue
Block a user