-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Quality improvements for az aks extension and az aks extension type command groups #8794
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
base: main
Are you sure you want to change the base?
Conversation
…into sophiezhao/coreExtensions
️✔️Azure CLI Extensions Breaking Change Test
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR aims to enhance the quality of the az aks extension and az aks extension type command groups by refining error messages, strengthening input validation, and ensuring consistency in help text terminology.
- Improved error messaging for extension type validation in the create command.
- Introduced a new helper to filter extensions against the allowed list and applied an updated validator for location/cluster parameters.
- Updated help texts and release history to align with the new "Cluster Extension" terminology.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/aks-preview/setup.py | Version bump from 18.0.0b3 to 18.0.0b4. |
src/aks-preview/azext_aks_preview/custom.py | Updated show command to use the new helper for allowed list filtering. |
src/aks-preview/azext_aks_preview/_validators.py | Added a new validator (validate_location_cluster_parameters_present) for location/cluster checks. |
src/aks-preview/azext_aks_preview/_params.py | Updated argument validators to use the new location/cluster validator. |
src/aks-preview/azext_aks_preview/_helpers.py | Improved the error message for validation failure and introduced get_extension_in_allow_list. |
src/aks-preview/azext_aks_preview/_help.py | Updated help texts to replace "K8s Extension" with "Cluster Extension" consistently. |
src/aks-preview/HISTORY.rst | Updated the release history with the new version number and release notes. |
Comments suppressed due to low confidence (1)
src/aks-preview/azext_aks_preview/_helpers.py:446
- [nitpick] The function name get_extension_in_allow_list may be ambiguous since it returns None when the extension type is not allowed. Consider renaming it to filter_extension_in_allow_list to more clearly convey its behavior.
def get_extension_in_allow_list(result):
@@ -442,3 +442,8 @@ def get_all_extensions_in_allow_list(result): | |||
if _check_if_extension_type_is_in_allow_list(obj.extension_type.lower()): | |||
output.append(obj) | |||
return output | |||
|
|||
def get_extension_in_allow_list(result): |
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.
Review whether returning None when the extension does not pass the allowed list check is the best approach for error handling. Consider if raising a ValidationError might provide clearer feedback in the command workflow.
Copilot uses AI. Check for mistakes.
|
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.
Looks good to me. I had a few minor comments and one outstanding question for Fuming, as I think the required changes to the recordings don't look quite right to me (or rather they look right but I assume Fuming has another PR where he's already dealing with them?)
@@ -60,7 +60,7 @@ interactions: | |||
User-Agent: | |||
- AZURECLI/2.53.0 azsdk-python-azure-mgmt-resource/23.1.0b2 Python/3.8.10 (Linux-5.15.0-1051-azure-x86_64-with-glibc2.29) | |||
method: GET | |||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001?api-version=2022-09-01 | |||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001?api-version=2024-11-01 |
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.
@FumingZhang - Do you understand why these changes were required?
Do you have an outstanding PR to tackle these that Sophie could rebase onto?
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.
yep, I've applied fix for failed test cases in PR #8798
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.
please rebase from main to drop unrelated changes
@@ -16176,4 +16176,4 @@ def test_aks_loadbalancer_commands( | |||
# self.cmd( |
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.
please remove self.cmd('extension add -n k8s-extension')
from the init function.
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.
Also, for cases where you need to install an extension, I recommend marking them as @live_only()
and you can remove the corresponding recording file
…into sophiezhao/coreExtensions
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.
I think the _backup.yaml
files aren't intentionally added?
) | ||
|
||
"""Validates that location, cluster name, and resource group name are not specified at the same time""" | ||
if location and resource_group_name and cluster_name: |
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.
if location and resource_group_name and cluster_name: | |
if location and (resource_group_name or cluster_name): |
So you reject --location
+ --cluster-name
too, which shouldn't be allowed.
This PR contains the following improvements for the az aks extension and az aks extension type command groups:
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
General Guidelines
azdev style <YOUR_EXT>
locally? (pip install azdev
required)python scripts/ci/test_index.py -q
locally? (pip install wheel==0.30.0
required)For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update
src/index.json
automatically.You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify
src/index.json
.