Skip to content

Conversation

@jiasli
Copy link
Member

@jiasli jiasli commented Jul 31, 2023

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.

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jul 31, 2023

️✔️AzureCLI-FullTest
️✔️acr
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️acs
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️advisor
️✔️latest
️✔️3.10
️✔️3.9
️✔️ams
️✔️latest
️✔️3.10
️✔️3.9
️✔️apim
️✔️latest
️✔️3.10
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.10
️✔️3.9
️✔️appservice
️✔️latest
️✔️3.10
️✔️3.9
️✔️aro
️✔️latest
️✔️3.10
️✔️3.9
️✔️backup
️✔️latest
️✔️3.10
️✔️3.9
️✔️batch
️✔️latest
️✔️3.10
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.10
️✔️3.9
️✔️billing
️✔️latest
️✔️3.10
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.10
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.10
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.10
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.10
️✔️3.9
️✔️config
️✔️latest
️✔️3.10
️✔️3.9
️✔️configure
️✔️latest
️✔️3.10
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.10
️✔️3.9
️✔️container
️✔️latest
️✔️3.10
️✔️3.9
️✔️core
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.10
️✔️3.9
️✔️databoxedge
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️dla
️✔️latest
️✔️3.10
️✔️3.9
️✔️dls
️✔️latest
️✔️3.10
️✔️3.9
️✔️dms
️✔️latest
️✔️3.10
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.10
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.10
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.10
️✔️3.9
️✔️find
️✔️latest
️✔️3.10
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.10
️✔️3.9
️✔️identity
️✔️latest
️✔️3.10
️✔️3.9
️✔️iot
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️keyvault
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️kusto
️✔️latest
️✔️3.10
️✔️3.9
️✔️lab
️✔️latest
️✔️3.10
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.10
️✔️3.9
️✔️maps
️✔️latest
️✔️3.10
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.10
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.10
️✔️3.9
️✔️mysql
️✔️latest
️✔️3.10
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.10
️✔️3.9
️✔️network
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.10
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.10
️✔️3.9
️✔️profile
️✔️latest
️✔️3.10
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.10
️✔️3.9
️✔️redis
️✔️latest
️✔️3.10
️✔️3.9
️✔️relay
️✔️latest
️✔️3.10
️✔️3.9
️✔️resource
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️role
️✔️latest
️✔️3.10
️✔️3.9
️✔️search
️✔️latest
️✔️3.10
️✔️3.9
️✔️security
️✔️latest
️✔️3.10
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.10
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.10
️✔️3.9
️✔️servicefabric
️✔️latest
️✔️3.10
️✔️3.9
️✔️signalr
️✔️latest
️✔️3.10
️✔️3.9
️✔️sql
️✔️latest
️✔️3.10
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.10
️✔️3.9
️✔️storage
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.10
️✔️3.9
️✔️telemetry
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️util
️✔️latest
️✔️3.10
️✔️3.9
️✔️vm
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jul 31, 2023

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan
Copy link
Collaborator

yonzhan commented Jul 31, 2023

Packaging

@ghost ghost requested a review from wangzelin007 July 31, 2023 12:58
@ghost ghost requested a review from kairu-ms July 31, 2023 12:58
@ghost ghost added the Auto-Assign Auto assign by bot label Jul 31, 2023
@ghost ghost assigned jiasli Jul 31, 2023
Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Member Author

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

@jiasli
Copy link
Member Author

jiasli commented Jul 31, 2023

To test this TestMSIInstallation job quickly, azure-pipelines.yml can be simplified as

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.ps1

Because dependencies on BuildWindowsMSI and ExtractMetadata are removed, we also need to add below lines to the top of build_scripts/windows/scripts/test_msi_installation.ps1 to run it without the output of other jobs:

# 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 build_scripts/windows/scripts/test_msi_installation.ps1 on local machine.

@jiasli
Copy link
Member Author

jiasli commented Aug 29, 2023

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jiasli jiasli merged commit d419ab3 into Azure:dev Aug 29, 2023
@jiasli jiasli deleted the test-msi branch August 29, 2023 11:15
@jiasli jiasli restored the test-msi branch August 29, 2023 11:15
@jiasli jiasli deleted the test-msi branch August 29, 2023 11:15
@jiasli jiasli restored the test-msi branch August 29, 2023 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants