[ACR] Warn before overwriting an existing cache rule - #33911
Open
Mabel Egba (mabelegba) wants to merge 3 commits into
Open
[ACR] Warn before overwriting an existing cache rule#33911Mabel Egba (mabelegba) wants to merge 3 commits into
Mabel Egba (mabelegba) wants to merge 3 commits into
Conversation
added 2 commits
August 17, 2026 15:45
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. |
microsoft-github-policy-service
Bot
requested review from
Bin Du (northtyphoon) and
Terence Truong (terencet-dev)
August 17, 2026 21:20
Member
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Contributor
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.
| from azure.cli.command_modules.acr._constants import ACR_AUDIENCE_RESOURCE_NAME | ||
| from azure.cli.command_modules.acr.cache import acr_cache_create | ||
| from azure.cli.core.mock import DummyCli | ||
| from azure.core.exceptions import ResourceNotFoundError |
Comment on lines
+73
to
+81
| try: | ||
| client.get(resource_group_name=rg, | ||
| registry_name=registry_name, | ||
| cache_rule_name=name) | ||
| logger.warning( | ||
| "A cache rule named '%s' already exists. The existing cache rule will be overwritten.", | ||
| name) | ||
| except ResourceNotFoundError: | ||
| pass |
Member
|
what do we allow implicit overwrite in |
Member
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 PR Validation — ❌ Action needed
❌AzureCLI-FullTest
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.