{Packaging} Add warning message for Azure Linux 2.0#31545
{Packaging} Add warning message for Azure Linux 2.0#31545jiasli merged 1 commit intoAzure:release-2.74-cm2from
Conversation
️✔️AzureCLI-FullTest
|
|
Hi @jiasli, |
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull Request Overview
Adds a deprecation warning for Azure Linux 2.0 users and a toggle via environment variable
- Introduces a new constant
AZURELINUX2_WARNING_MESSAGEwith migration guidance - Imports
osand checksAZURE_CLI_DISABLE_AZURELINUX2_WARNINGto conditionally log the warning - Emits the warning on every CLI run when not disabled
Comments suppressed due to low confidence (1)
src/azure-cli/azure/cli/main.py:125
- The warning is logged unconditionally on every platform; add a check to detect Azure Linux 2.0 (e.g., via /etc/os-release or platform library) so it only appears for that OS.
if 'AZURE_CLI_DISABLE_AZURELINUX2_WARNING' not in os.environ:
src/azure-cli/azure/cli/__main__.py
Outdated
| AZURELINUX2_WARNING_MESSAGE = ( | ||
| "Azure CLI 2.74.0 is the last version available on Azure Linux (Mariner) 2.0 and will not receive updates. " | ||
| "Consider migrating to Azure Linux 3.0 to use newer versions of Azure CLI. " | ||
| "To disable this warning message, set AZURE_CLI_DISABLE_AZURELINUX2_WARNING environment variable to any value." |
There was a problem hiding this comment.
#29628 has a sentence:
For more information: https://go.microsoft.com/fwlink/?linkid=2282203
But there is no public document for Azure Linux 2.0's EOL. https://github.com/microsoft/azurelinux doesn't mention this. There is only an internal document: https://eng.ms/docs/products/azure-linux/overview/20eol. microsoft/azurelinux#13555 was raised for this issue.
There was a problem hiding this comment.
Azure Linux confirmed there will be no public announcement for Azure Linux 2.0's EOL.
| if 'AZURE_CLI_DISABLE_AZURELINUX2_WARNING' not in os.environ: | ||
| logger.warning(AZURELINUX2_WARNING_MESSAGE) |
There was a problem hiding this comment.
The warning can also be disabled by az config set core.only_show_errors=true, but as #29628 (comment) mentioned, this will disable other warning messages too.
Introducing an environment variable AZURE_CLI_DISABLE_AZURELINUX2_WARNING will make it possible to disable only this warning message.
Adding a config option core.disable_azurelinux2_warning is also possible but a little bit too heavy and formal, an requires official documentation. AZURE_CLI_DISABLE_AZURELINUX2_WARNING is only a one-time feature and will not exist in the dev branch of Azure CLI.
564ad75 to
048f978
Compare
048f978 to
9250779
Compare
|
Verified this PR in And in |
|
Could you please explain why this pollutes all azure-cli usage? the warning should only be added to azure linux related command. |


Description
According to microsoft/azurelinux#13555, Azure Linux 2.0 will reach its End of Life (EOL) on July 2025.
Azure CLI 2.74.0 (release date: 2025-06-03) will be the last version that supports Azure Linux 2.0. Azure CLI 2.75.0 (release date: 2025-07-01) will not be released for Azure Linux 2.0.
Similar to #29628, this PR displays a warning message solely for Azure Linux 2.0 RPMs:
Note
This PR will not be merged into
devbranch. Instead, after 2.74.0 is released, a separate branchrelease-2.74-azurelinux2will be created and this PR will be merged into it. Then a separate release pipeline will be triggered specifically for Azure Linux 2.0.Azure Linux 2.0 support will be fully dropped by #31533
Testing Guide