[ACR] Warn before overwriting an existing cache rule - #33911
[ACR] Warn before overwriting an existing cache rule#33911Mabel Egba (mabelegba) wants to merge 6 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e82f65c8-d0e4-4013-8ba8-5f3e0e19f031
|
Hi Mabel Egba (@mabelegba), |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR adds a user-facing warning to az acr cache create when a cache rule with the same name already exists, signaling that the operation will overwrite the existing rule.
Changes:
- Added an existence check in
acr_cache_createand logs a warning when the cache rule already exists. - Added a mock unit test validating that the warning is emitted when the pre-check finds an existing rule.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/acr/cache.py | Adds a preflight get call and warning before overwriting an existing cache rule. |
| src/azure-cli/azure/cli/command_modules/acr/tests/latest/test_acr_commands_mock.py | Adds a mock test to assert the overwrite warning is logged. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
what do we allow implicit overwrite in |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e82f65c8-d0e4-4013-8ba8-5f3e0e19f031
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Bin Du (@northtyphoon) |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e82f65c8-d0e4-4013-8ba8-5f3e0e19f031
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
| source_repo='mcr.microsoft.com/mcr/hello-world', | ||
| target_repo='hello-world') | ||
|
|
||
| mock_warning.assert_called_once_with( |
There was a problem hiding this comment.
Are we testing both outcomes, ie. if the rule already exists and if it doesn't exist? How does the test guarantee that the rule exists?
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
🤖 PR Validation — ️✔️ All clear
Related command
az acr cache createDescription
Adds a warning that creating a cacherule with an existing name will overwrite it.
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.