[Compute] az vmss lifecycle-hook/ lifecycle-hook-event: Add new command groups to support vmss lifecycle hooks - #33758
Conversation
|
Hi @william051200, |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
az vmss lifecycle-hooks &az vmss lifecycle-hooks-event: Add new command groups to support vmss lifecycle hooksaz vmss lifecycle-hooks/ lifecycle-hooks-event: Add new command groups to support vmss lifecycle hooks
az vmss lifecycle-hooks/ lifecycle-hooks-event: Add new command groups to support vmss lifecycle hooksaz vmss lifecycle-hook/ lifecycle-hook-event: Add new command groups to support vmss lifecycle hooks
There was a problem hiding this comment.
Pull request overview
This PR adds new preview command groups under the vmss command module to manage VM Scale Set lifecycle hooks and to interact with platform-generated lifecycle hook events, along with scenario tests and recordings.
Changes:
- Add
az vmss lifecycle-hookcommands (add/update/remove/show/list) backed by new custom implementations. - Add
az vmss lifecycle-hook-eventcommands, including AAZ-generated list/show/update and custom wrappers for update/approve/reject with client-side validation. - Add scenario tests and a recording to validate core command behaviors.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py | Adds scenario tests for lifecycle-hook and lifecycle-hook-event command groups. |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vmss_lifecycle_hook_event.yaml | Adds recording for lifecycle-hook-event list scenario. |
| src/azure-cli/azure/cli/command_modules/vm/custom.py | Implements lifecycle hook CRUD and lifecycle hook event update/approve/reject helpers. |
| src/azure-cli/azure/cli/command_modules/vm/commands.py | Registers new command groups and wires validators. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/lifecycle_hook_event/_update.py | Adds AAZ-generated vmss lifecycle-hook-event update. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/lifecycle_hook_event/_show.py | Adds AAZ-generated vmss lifecycle-hook-event show. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/lifecycle_hook_event/_list.py | Adds AAZ-generated vmss lifecycle-hook-event list. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/lifecycle_hook_event/init.py | Exposes lifecycle_hook_event AAZ commands for loading. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/lifecycle_hook_event/__cmd_group.py | Registers the AAZ command group for lifecycle hook events. |
| src/azure-cli/azure/cli/command_modules/vm/_validators.py | Adds validators for hook removal and lifecycle-hook-event update/action behaviors. |
| src/azure-cli/azure/cli/command_modules/vm/_params.py | Adds argument definitions/enums for lifecycle hook and lifecycle hook event commands. |
| src/azure-cli/azure/cli/command_modules/vm/_help.py | Adds help content for the new command groups/commands. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # AZURE CLI VM TEST DEFINITIONS | ||
| import json | ||
| import os | ||
| import datetime |
| def _commit_vmss_lifecycle_hooks(cmd, resource_group_name, vmss_name, hooks, no_wait): | ||
| from .operations.vmss import VMSSCreate, convert_show_result_to_snake_case | ||
| vmss = get_vmss_modified_by_aaz(cmd, resource_group_name, vmss_name) | ||
| vmss = convert_show_result_to_snake_case(vmss) | ||
| vmss["lifecycle_hooks_profile"] = {"lifecycle_hooks": hooks} | ||
| vmss["resource_group"] = resource_group_name | ||
| vmss["vm_scale_set_name"] = vmss_name | ||
| vmss["no_wait"] = no_wait | ||
| return VMSSCreate(cli_ctx=cmd.cli_ctx)(command_args=vmss) |
| helps['vmss lifecycle-hook-event'] = """ | ||
| type: group | ||
| short-summary: Manage virtual machine scale set lifecycle hook events. | ||
| """ |
az vmss lifecycle-hook/ lifecycle-hook-event: Add new command groups to support vmss lifecycle hooksaz vmss lifecycle-hook/ lifecycle-hook-event: Add new command groups to support vmss lifecycle hooks
|
Compute |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
Automated sensitive-information remediation ran on this pull request.
If a credential was exposed, rotate or revoke it immediately. Detected values are never copied into this comment. ✅ Keep the redaction · ❌ Dispute the redaction GitHub only supports a fixed reaction set, so 👍 represents ✅ and 👎 represents ❌. The bot-created reactions are only poll choices. Posted by agent-assist (autonomous bug-fix pipeline). |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
🔔 Routing this PR to @Azure/act-observability-squad. |
🤖 PR Validation —⚠️ Review suggested
Related command
az vmss lifecycle-hook add/list/remove/show/updateaz vmss lifecycle-hook-event approve/list/reject/show/updateDescription
Resolve #33652
aaz Azure/aaz#1046
Testing Guide
Refer to
azure-cli\src\azure-cli\azure\cli\command_modules\vm\tests\latest\test_vm_commands.py:test_vmss_lifecycle_hooktest_vmss_lifecycle_hook_eventaz vmss lifecycle-hook-event approve/reject/updateare not included in the test cases as they required live platform-generated event. Service team will be helping with the test locally.History Notes
[Compute]
az vmss lifecycle-hook/ lifecycle-hook-event: Add new command groups to support vmss lifecycle hooksThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.