Skip to content

az --version performs an update check #27437

Open

Description

Describe the bug

When running az --version an update check is performed against az-cli and the extensions.

Azure Pipelines' AzureCLI task runs az --version to capture the version details in the logs.

It would save quite a bit of CPU if az-cli would not perform an update check in a CI/CD scenario.

There already is an core.auto-upgrade=false option, would it not make sense to piggy back on that or to add another config setting to turn off update checking.

Related command

az --version

Errors

N/a

Issue script & Debug output

N/a

Expected behavior

No update check is performed in CI.

Environment Summary

2.52.0

Additional context

No response

Activity

  1. added
    bugThis issue requires a change to an existing behavior in the product in order to be resolved.
    on Sep 20, 2023
  2. yonzhan commented on Sep 20, 2023

    @yonzhan
    Collaborator

    Thank you for opening this issue, we will look into it.

  3. added
    CoreCLI core infrastructure
    questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
    Azure CLI TeamThe command of the issue is owned by Azure CLI team
    and removed
    bugThis issue requires a change to an existing behavior in the product in order to be resolved.
    on Sep 21, 2023
  4. added this to the Backlog milestone on Sep 21, 2023
  5. jiasli commented on Sep 28, 2023

    @jiasli
    Contributor

    There already is an core.auto-upgrade=false option

    According to https://learn.microsoft.com/en-us/cli/azure/update-azure-cli#automatic-update, it should be auto-upgrade.enable=yes.

    We do have az version command that doesn't make any network request (#27457 (comment)). I think what you are asking for is an option to disable update check in az --version, while #27457 asks for an option to enable version check in az version. 🤣

  6. jessehouwing commented on Sep 28, 2023

    @jessehouwing
    Author

    Yeah, have a way to disable network access for these commands. Either with an extra parameter to --check-updates true or a setting in the config file or an environment variable.

    Ideally az would detect it's in CI/CD and turn off a load of stuff that only adds logspam and slowdowns by default.

    It looks like az init is making a start of collecting the desired settings ;).

  7. jiasli commented on Sep 28, 2023

    @jiasli
    Contributor

    az init is actually a secret project. May I know where you heard of it? 🤣

  8. jessehouwing commented on Sep 28, 2023

    @jessehouwing
    Author

    az init is actually a secret project. May I know where you heard of it? 🤣

    I was looking for a way to set the default config settings, and I tried it on the console. Lo and behold it downloaded the extension and ran.

    I supplied a PR for it to add a few more settings.

  9. jiasli commented on Sep 28, 2023

    @jiasli
    Contributor

    Ideally az would detect it's in CI/CD and turn off a load of stuff that only adds logspam and slowdowns by default.

    This is another topic we are still internally investigating. Not only Azure DevOps, we are aiming to find a unified way to detect the running environment - Azure DevOps, Azure Cloud Shell, GitHub Actions, etc.

  10. jiasli commented on Sep 28, 2023

    @jiasli
    Contributor

    az init is only an experimental feature we made in Azure/azure-cli-extensions#3969. It is never expected to be used in production. Also, az init allows the user to select the running environment. It can't really detect the running environment.

  11. jessehouwing commented on Sep 28, 2023

    @jessehouwing
    Author

    az init is only an experimental feature we made in Azure/azure-cli-extensions#3969. It is never expected to be used in production. Also, az init allows the user to select the running environment. It can't really detect the running environment.

    Yeah, I figured as much. The experimental nature at least. But it does seem to reccomend certain settings in an automated environment.

    As you mentioned above auto-upgrade.enable=yes in the docs turns out to probably be auto-upgrade.enable=true in the code, at least there are quite a few issues that dispute the correct syntax. I went looking for what settings there are and what their values should/could be and there is VERY little documentation on those topics.

    I ended up doing a search through the codebase instead. But it lead to some useful insights!

    I've been digging into the performance of az and az devops in Azure Pipelines and GtHub Hosted Runners.

    If these each shave off a couple of seconds, over the number of invocations on the hosted runners worldwide it would save a couple of trees and a bunch of water.

    Ideally az would detect it's in a CI/CD environment and turn off:

    • Telemetry
    • Disk logging
    • Error recommendations
    • Colors
    • Auto-updates
    • Version checks
    • Survey banners
    • auto-installation of missing extensions
    • Randomly downloading new pip packages (like keyring) or helm versions or other unexpectedly missing dependencies. I'd rather have it fail in CI/CD than for it to download versions of files I haven't been able to vet.

    And would allow:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Azure CLI TeamThe command of the issue is owned by Azure CLI teamCoreCLI core infrastructureUpgradeaz upgradeact-platform-engineering-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions