-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{Packaging} Test x86 and x64 MSI installation #27038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Packaging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, when we added a benchmark to monitor the MSI installation time https://github.com/Azure/azure-cli/compare/installation-benchmark, we uninstall Azure CLI MSI with
Uninstall-Package -Name "Microsoft Azure CLI"so we use the same approach here.
However, Uninstall-Package only works in Windows PowerShell. The latest Uninstall-Package doesn't work in PowerShell Core. Still consulting PowerShell team for the modern solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rdbms-connect fails to install due to #25188, so we try a simpler extension account.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no equivalent of set -e from Bash in PowerShell for native commands (az.cmd), so $ErrorActionPreference = "Stop" doesn't work even if az fails with exit code 2. That's why even though rdbms-connect fails to install, the script still succeeds. For native commands, we must manually check $LastExitCode. Not sure if we want to do that here.
See https://stackoverflow.com/questions/9948517/how-to-stop-a-powershell-script-on-the-first-error
|
To test this jobs:
- job: TestMSIInstallation
displayName: Test MSI Installation
strategy:
matrix:
x86:
Platform: x86
x64:
Platform: x64
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
pool:
name: ${{ variables.windows_pool }}
steps:
- task: PowerShell@2
displayName: Install and Load CLI
inputs:
filePath: build_scripts\windows\scripts\test_msi_installation.ps1Because dependencies on # Prepare env vars
$env:SYSTEM_ARTIFACTSDIRECTORY='D:\test'
$env:PLATFORM='x64'
# Prepare metadata
$local_test_version = '2.51.0'
mkdir $env:SYSTEM_ARTIFACTSDIRECTORY\metadata
# Prepare MSI package by downloading from official URL
Write-Output $local_test_version > $env:SYSTEM_ARTIFACTSDIRECTORY\metadata\version
mkdir $env:SYSTEM_ARTIFACTSDIRECTORY\msi
if ($env:PLATFORM -eq 'x64') {
$platform_suffix = '-x64'
} else {
$platform_suffix = ''
}
curl.exe "https://azcliprod.blob.core.windows.net/msi/azure-cli-$local_test_version$platform_suffix.msi" -o "$env:SYSTEM_ARTIFACTSDIRECTORY\msi\Microsoft Azure CLI.msi"You may also run the modified |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
As explained in #17317 (comment), CI job TestWindowsMSI never works as expected. The test for x64 MSI is disabled by #27018.
However, that issue doesn't happen if the artifact MSI has higher version, as in that case, the script doesn't append
"REINSTALL=ALL REINSTALLMODE=emus"and x64 MSI uninstalls x86 MSI (#26640 (comment)).In order to mimic a clean installation, this PR changes the logic to uninstall the pre-installed Azure CLI first, then install the artifact MSI.