Skip to content

Conversation

@atharvau
Copy link
Member

@atharvau atharvau commented Jul 17, 2025


Fix contextId handling in workload-orchestration target commands

Summary

This PR addresses critical issues with contextId parameter handling in the workload-orchestration extension's target create and update commands, ensuring proper Azure resource management workflows.

Changes Made

1. Added required context-id parameter to target create command

  • Added --context-id parameter as a required argument for target creation
  • Ensures all targets are properly associated with their execution context
  • Prevents creation of orphaned target resources

2. Fixed target update command contextId preservation

  • Problem: The target update command was failing with ObjectMissingRequiredProperty: contextId errors
  • Root Cause: The AAZ update operation follows a READ → PATCH → PUT pattern, but the contextId property was being dropped from the PUT payload due to missing schema definition
  • Solution: Added contextId property to the target schema in _UpdateHelper._build_schema_target_read() method
  • Impact: Target update operations now properly preserve the contextId during round-trip operations

Technical Details

  • Modified _update.py to include contextId in the target resource schema
  • Added proper serialization mapping (serialized_name="contextId")
  • Marked as required field (flags={"required": True})
  • Ensures compatibility with Azure Resource Manager requirements

Testing

  • Verified target update commands no longer fail with contextId validation errors
  • Confirmed contextId is preserved during update operations
  • Tested with various target properties to ensure no regression

Test Evidence.pdf

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.

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

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

❌Azure CLI Extensions Breaking Change Test
❌workload-orchestration
rule cmd_name rule_message suggest_message
1008 - ParaPropAdd workload-orchestration target create cmd workload-orchestration target create update parameter context_id: added property required=True please remove property required=True for parameter context_id of cmd workload-orchestration target create
⚠️ 1009 - ParaPropRemove workload-orchestration target create cmd workload-orchestration target create update parameter description: removed property required=True

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

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
Collaborator

yonzhan commented Jul 17, 2025

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

@github-actions
Copy link

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

CodeGen Tools Feedback Collection

Thank you for using our CodeGen tool. We value your feedback, and we would like to know how we can improve our product. Please take a few minutes to fill our codegen survey

@github-actions
Copy link

github-actions bot commented Jul 17, 2025

@github-actions github-actions bot added the release-version-block Updates do not qualify release version rules. NOTE: please do not edit it manually. label Jul 17, 2025
@github-actions github-actions bot removed the release-version-block Updates do not qualify release version rules. NOTE: please do not edit it manually. label Jul 17, 2025
@yonzhan yonzhan requested review from jsntcy and kairu-ms July 17, 2025 08:35
@github-actions github-actions bot added the release-version-block Updates do not qualify release version rules. NOTE: please do not edit it manually. label Jul 17, 2025
@atharvau atharvau marked this pull request as ready for review July 18, 2025 06:10
Copilot AI review requested due to automatic review settings July 18, 2025 06:10
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

This PR addresses critical contextId handling issues in the workload-orchestration extension's target commands and updates documentation/packaging. The changes ensure proper Azure resource management workflows by fixing parameter requirements and schema definitions.

Key changes include:

  • Fixed target update command to preserve contextId during round-trip operations by adding it to the schema
  • Made context-id parameter required for target create operations
  • Updated package version to 2.0.0 with enhanced documentation and metadata

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
setup.py Version bump to 2.0.0, status change to stable, and enhanced package description
_update.py Added contextId to target schema and fixed provider namespace casing
_create.py Made context-id parameter required and fixed provider namespace casing
README.md Added comprehensive documentation about workload orchestration features
HISTORY.rst Added changelog entry for version 2.0.0
Comments suppressed due to low confidence (2)

@github-actions github-actions bot removed the release-version-block Updates do not qualify release version rules. NOTE: please do not edit it manually. label Jul 18, 2025
@necusjz
Copy link
Member

necusjz commented Jul 18, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@necusjz necusjz merged commit b1dadc0 into Azure:main Jul 18, 2025
24 checks passed
options=["--description"],
arg_group="Properties",
help="Description of target",
required=True,
Copy link
Member

Choose a reason for hiding this comment

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

revert?

fmt=AAZStrArgFormat(
pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
),

Copy link
Member

Choose a reason for hiding this comment

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

nit: extra line

@azclibot
Copy link
Collaborator

[Release] Update index.json for extension [ workload-orchestration-2.0.0 ] : https://dev.azure.com/msazure/One/_build/results?buildId=130825035&view=results

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.

6 participants