[Containerapp] az containerapp create: Support other cloud for acr#33160
[Containerapp] az containerapp create: Support other cloud for acr#33160
az containerapp create: Support other cloud for acr#33160Conversation
️✔️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 updates Container Apps registry handling to better recognize Azure Container Registry (ACR) endpoints across sovereign clouds (e.g., .azurecr.cn, .azurecr.us) and reuse that logic consistently across create/update flows.
Changes:
- Added
ACR_IMAGE_SUFFIXESplus helper utilities (is_acr_url,get_acr_name) to identify/parse ACR registry servers across clouds. - Replaced multiple
ACR_IMAGE_SUFFIX in <server>checks withis_acr_url(<server>)in containerapp/containerappsjob logic and decorators. - Updated registry identity validation messaging to reflect additional ACR domains.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/containerapp/custom.py |
Switches ACR detection from string-contains checks to is_acr_url() in several registry inference paths. |
src/azure-cli/azure/cli/command_modules/containerapp/containerapp_job_registry_decorator.py |
Uses is_acr_url() for ACR credential inference in job registry set flow. |
src/azure-cli/azure/cli/command_modules/containerapp/_validators.py |
Uses is_acr_url() for registry identity validation and create-time registry argument validation. |
src/azure-cli/azure/cli/command_modules/containerapp/_utils.py |
Introduces is_acr_url() / get_acr_name() helpers and updates role assignment logic to use get_acr_name(). |
src/azure-cli/azure/cli/command_modules/containerapp/_up_utils.py |
Updates az containerapp up registry logic to rely on is_acr_url() and get_acr_name(). |
src/azure-cli/azure/cli/command_modules/containerapp/_constants.py |
Adds ACR_IMAGE_SUFFIXES for sovereign cloud ACR domains. |
Comments suppressed due to low confidence (1)
src/azure-cli/azure/cli/command_modules/containerapp/_up_utils.py:976
- In
_get_registry_details, the newis_acr_url()check allows sovereign ACR domains (e.g..azurecr.us/.cn), but later in the same function the default/inferred server is still constructed asregistry_name + ACR_IMAGE_SUFFIX(which is hardcoded to.azurecr.io). In sovereign clouds this will produce an incorrect login server and can break--sourceworkflows and pushes when an existing ACR is found by name. Consider deriving the login server from the actual ACR resource (e.g.acr_show(...).login_server) or selecting the suffix based on the current cloud.
def _get_registry_details(cmd, app: "ContainerApp", source):
registry_rg = None
registry_name = None
if app.registry_server:
if not is_acr_url(app.registry_server) and source:
raise ValidationError(
"Cannot supply non-Azure registry when using --source."
)
parsed = urlparse(app.registry_server)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Related command
Fix issue: Azure/azure-cli-extensions#9728
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.