[Container App] az containerapp job update: Fix --min-executions and --max-executions not accepting 0 values#31906
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
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.
Pull Request Overview
This PR fixes an issue where min_executions and max_executions parameters were not being properly updated when set to 0 in the az containerapp job update CLI command. The root cause was that the conditional logic was evaluating 0 as falsy, preventing these parameters from being included in the update operation.
- Fixed conditional logic to properly handle
min_executionsandmax_executionswhen set to 0 - Added comprehensive end-to-end test coverage to verify the fix works correctly
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| custom.py | Updated condition to use is not None check instead of truthiness evaluation for min/max executions |
| test_containerappjob_crud.py | Added comprehensive test to verify min/max executions can be set to 0 and updated properly |
| update_map = {} | ||
| update_map['replicaConfigurations'] = replica_timeout or replica_retry_limit | ||
| update_map['triggerConfigurations'] = replica_completion_count or parallelism or cron_expression or scale_rule_name or scale_rule_type or scale_rule_auth or polling_interval or min_executions or max_executions | ||
| update_map['triggerConfigurations'] = replica_completion_count or parallelism or cron_expression or scale_rule_name or scale_rule_type or scale_rule_auth or polling_interval or min_executions is not None or max_executions is not None |
There was a problem hiding this comment.
This line is extremely long and hard to read. Consider breaking it into multiple lines for better readability, using parentheses for proper alignment.
| update_map['triggerConfigurations'] = replica_completion_count or parallelism or cron_expression or scale_rule_name or scale_rule_type or scale_rule_auth or polling_interval or min_executions is not None or max_executions is not None | |
| update_map['triggerConfigurations'] = ( | |
| replica_completion_count | |
| or parallelism | |
| or cron_expression | |
| or scale_rule_name | |
| or scale_rule_type | |
| or scale_rule_auth | |
| or polling_interval | |
| or min_executions is not None | |
| or max_executions is not None | |
| ) |
There was a problem hiding this comment.
@khushishah513 @Greedygre I think Copilot's suggestion is worth considering, what do you think?
az containerapp job update: Fix min_executions and max_executions not accepting 0 values
az containerapp job update: Fix min_executions and max_executions not accepting 0 valuesaz containerapp job update: Fix min_executions and max_executions not accepting 0 values
@microsoft-github-policy-service agree company="Microsoft" |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
Recommend title: The title will be used in the CLI release version description. |
| - python/3.12.3 (Linux-6.6.87.1-microsoft-standard-WSL2-x86_64-with-glibc2.39) | ||
| AZURECLI/2.76.0 | ||
| method: PUT | ||
| uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.App/jobs/eventjob000002?api-version=2025-02-02-preview |
There was a problem hiding this comment.
I notice in the azure-cli recording file the api-version is 2025-02-02-preview:
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.App/jobs/eventjob000002?api-version=2025-02-02-preview
Due to in the CI pipeline, it will not install containerapp extension, so the api-version should be 2025-03-01.
You can see the integration test CI failed with api-version mismatch.
To fix this, you need to uninstall extension first, then run this test again:
az extension remove -n containerapp
azdev test run containertapp.test_containerappjob_update_min_max_executions_zero_e2e
There was a problem hiding this comment.
Thanks for pointing this out, I have run the test again.
az containerapp job update: Fix min_executions and max_executions not accepting 0 valuesaz containerapp job update: Fix --min-executions and --max-executions not accepting 0 values
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Related command
Description
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis 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.