Skip to content

Conversation

@sophsoph321
Copy link
Contributor


This PR adds validation error when neither --location or --cluster and --resource-group-name parameters are specified for the commands az extension type list or az extension type version list

This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

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.

Copilot AI review requested due to automatic review settings July 3, 2025 18:43
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jul 3, 2025

️✔️Azure CLI Extensions Breaking Change Test
️✔️Non Breaking Changes

@github-actions
Copy link

github-actions bot commented Jul 3, 2025

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).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@yonzhan
Copy link
Collaborator

yonzhan commented Jul 3, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds argument validation for the az aks extension type list and az aks extension type version list commands when neither location nor both resource group/name are provided, alongside version bump and documentation updates.

  • Bump extension version to 18.0.0b18
  • Add a new validator in _validators.py enforcing --location or --cluster & --resource-group-name
  • Update HISTORY, README troubleshooting example, and add JSON-based checks for connectedk8s troubleshooting

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/connectedk8s/azext_connectedk8s/troubleshoot.json Add new checks for Helm installation, version, and Azure permissions
src/connectedk8s/README.md Add az connectedk8s troubleshoot example
src/aks-preview/setup.py Bump extension version to 18.0.0b18
src/aks-preview/azext_aks_preview/_validators.py Enforce missing-parameter validation for location/cluster flags
src/aks-preview/HISTORY.rst Document the new validation behavior under version 18.0.0b18
Comments suppressed due to low confidence (3)

src/aks-preview/azext_aks_preview/_validators.py:969

  • The error message refers to --resource-group but the parameter is named --resource-group-name. Please update the message to the correct flag name.
            "You must specify --location or --resource-group and --cluster."

src/connectedk8s/README.md:60

  • The code block for the troubleshoot example isn’t closed or fully shown. Add a closing ``` and ensure the full command (including any flags or output) is provided.
    --name my-cluster \

src/connectedk8s/azext_connectedk8s/troubleshoot.json:23

  • The fail message ends with a colon but doesn’t include the actual command. Consider appending the recommended az role assignment command or instructions here.
        "FailMessage": "Please use the following command to get the correct permissions: ",

location = namespace.location
resource_group_name = namespace.resource_group_name
cluster_name = namespace.cluster_name
if not namespace.location and not namespace.cluster_name and not namespace.resource_group_name:
Copy link

Copilot AI Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition only fires when all three flags are missing. It doesn’t catch cases where only one of --resource-group-name or --cluster is provided without the other. Consider adding a separate check to require both or to use XOR logic when location is absent.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That check already exists below...

+++++++
18.0.0b18
+++++++
* Add validation error when neither --location or --cluster and --resource-group-name are specified for az extension type list or az extension type version list
Copy link

Copilot AI Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The phrasing is unclear. Consider rewording to: “Add validation error when neither --location nor both --cluster and --resource-group-name are specified.”

Suggested change
* Add validation error when neither --location or --cluster and --resource-group-name are specified for az extension type list or az extension type version list
* Add validation error when neither --location nor both --cluster and --resource-group-name are specified for az extension type list or az extension type version list

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

github-actions bot commented Jul 3, 2025

@yanzhudd
Copy link
Contributor

yanzhudd commented Jul 4, 2025

+@FumingZhang could you please help to review this PR as well?

@yanzhudd yanzhudd merged commit 5f1f3cb into Azure:main Jul 4, 2025
36 checks passed
@azclibot
Copy link
Collaborator

azclibot commented Jul 4, 2025

[Release] Update index.json for extension [ aks-preview-18.0.0b18 ] : https://dev.azure.com/msazure/One/_build/results?buildId=129329668&view=results

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

Labels

AKS Auto-Assign Auto assign by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants