Skip to content

Audapure/wo cli improvements#9861

Open
atharvau wants to merge 7 commits into
Azure:mainfrom
manaswita-chichili:audapure/wo-cli-improvements
Open

Audapure/wo cli improvements#9861
atharvau wants to merge 7 commits into
Azure:mainfrom
manaswita-chichili:audapure/wo-cli-improvements

Conversation

@atharvau
Copy link
Copy Markdown
Member


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.

Atharva and others added 2 commits May 13, 2026 09:57
The `az workload-orchestration cluster init` command depends on three
az CLI extensions at runtime (connectedk8s, k8s-extension, customlocation).
If any are missing, sub-command invocations fail with opaque errors.

This change adds a Step 0 in `target_prepare()` that ensures all three
extensions are installed before preflight, mirroring the
`azext_vme.utils.check_and_add_cli_extension` pattern.

- common/utils.py: add REQUIRED_CLI_EXTENSIONS, check_and_add_cli_extension,
  ensure_required_cli_extensions. Uses subprocess (not invoke_cli_command)
  so freshly installed extensions are picked up correctly.
- common/target.py: call ensure_required_cli_extensions() at the start of
  target_prepare; record step_results["cli-extensions"] = "Ready" on success
  and surface failures via _print_failure_hint.

Tested end-to-end: removed all 3 extensions, ran the auto-install path,
verified all 3 reinstalled successfully.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…: ..." log

The "Adding N: name1, name2, ..." line was duplicating information the
user just typed and could dump a huge comma-separated list to stdout for
bulk capability-add operations. The subsequent "Done (N total
capabilities)" line already conveys the result.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 13, 2026 04:41
@azure-client-tools-bot-prd
Copy link
Copy Markdown

Validation for Breaking Change Starting...

Thanks for your contribution!

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

Hi @atharvau,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented May 13, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

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>

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

Copy link
Copy Markdown
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

This PR improves the workload-orchestration extension’s target prepare flow by proactively ensuring dependent Azure CLI extensions are installed before invoking subcommands that rely on them, reducing failures due to missing extensions. It also removes a noisy capability-add log line in context operations.

Changes:

  • Add utilities to detect/install required Azure CLI extensions (connectedk8s, k8s-extension, customlocation) via a subprocess-based az extension add.
  • Invoke the dependency check at the start of target_prepare and surface status in the existing step-results failure hint flow.
  • Remove verbose “Adding …” logging from capability_add.

Reviewed changes

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

File Description
src/workload-orchestration/azext_workload_orchestration/common/utils.py Adds required-extension list and helper functions to check/install CLI dependencies.
src/workload-orchestration/azext_workload_orchestration/common/target.py Calls the new dependency check as “Step 0” in target_prepare.
src/workload-orchestration/azext_workload_orchestration/common/context.py Removes a capability-add status log line.

"-o", "tsv"],
capture_output=True, text=True, check=True, encoding="utf-8"
)
if extension_name in (result.stdout or "").strip():
Comment on lines +221 to +229
def ensure_required_cli_extensions(extension_names=None):
"""Ensure all required az CLI extensions are installed.

Defaults to REQUIRED_CLI_EXTENSIONS. Idempotent — skips already-installed
extensions. Fails fast with a clear message if any install fails.
"""
extensions = extension_names if extension_names is not None else REQUIRED_CLI_EXTENSIONS
for ext in extensions:
check_and_add_cli_extension(ext)
Atharva and others added 5 commits May 13, 2026 10:27
…tall

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add ServiceGroup creation status line (created/reused) with checkmark
in hierarchy create tree output, consistent with Site, Configuration,
and ConfigurationReference lines.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Matches the same cleanup already applied to add-capability.
The '✓ Done' message is sufficient feedback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Both add-capability and remove-capability were printing noisy
'✓ Done (N total capabilities)' messages to stderr. The JSON
response already contains the updated resource — no need for
extra status noise.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants