Skip to content

[ContainerApp] Fix az containerapp up --source crash: resolve OS/Architecture models from correct SDK package#33371

Open
lygav wants to merge 1 commit into
Azure:devfrom
lygav:fix/containerapp-up-os-model-resolution
Open

[ContainerApp] Fix az containerapp up --source crash: resolve OS/Architecture models from correct SDK package#33371
lygav wants to merge 1 commit into
Azure:devfrom
lygav:fix/containerapp-up-os-model-resolution

Conversation

@lygav
Copy link
Copy Markdown

@lygav lygav commented May 13, 2026

Related command
az containerapp up --source

Description

az containerapp up --source . crashes with AttributeError: 'NoneType' object has no attribute 'linux' because queue_acr_build() in _utils.py resolves OS, Architecture, DockerBuildRequest, and PlatformProperties models via cmd.get_models() using ResourceType.MGMT_CONTAINERREGISTRY with operation_group='runs'.

These models have moved to the azure-mgmt-containerregistrytasks SDK package, so cmd.get_models() silently returns None, and the subsequent OS.linux.value call crashes.

This PR updates both get_models() calls in queue_acr_build() to use ResourceType.MGMT_CONTAINERREGISTRYTASKS, which is already a declared dependency and contains the correct models.

Testing Guide

# Create a directory with a Dockerfile
mkdir test-app && cd test-app
cat > Dockerfile <<EOF
FROM ubuntu:24.04
CMD ["sleep", "infinity"]
EOF

# This should no longer crash
az containerapp up -n my-app -g my-rg --environment my-env --source .

The existing @live_only tests in test_containerapp_compose_registries.py cover queue_acr_build and would validate this fix in the nightly live test run.

History Notes

[ContainerApp] Fix az containerapp up --source: resolve OS/Architecture models from correct SDK package (MGMT_CONTAINERREGISTRYTASKS)

Fixes #33369


This checklist is used to make sure that common guidelines for a pull request are followed.

…om correct SDK package

queue_acr_build() resolves OS and Architecture models from
MGMT_CONTAINERREGISTRY, but these models have moved to the
azure-mgmt-containerregistrytasks package. This causes
cmd.get_models() to return None, crashing with:
  AttributeError: 'NoneType' object has no attribute 'linux'

Update both get_models() calls to use MGMT_CONTAINERREGISTRYTASKS
which is already a dependency and contains the correct models.

Fixes Azure#33369
Copilot AI review requested due to automatic review settings May 13, 2026 13:07
@azure-client-tools-bot-prd
Copy link
Copy Markdown

Validation for Azure CLI Full Test Starting...

Thanks for your contribution!

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Validation for Breaking Change Starting...

Thanks for your contribution!

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented May 13, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown

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).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@microsoft-github-policy-service
Copy link
Copy Markdown
Contributor

Thank you for your contribution @lygav! We will review the pull request and get back to you soon.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Auto-Assign Auto assign by bot label May 13, 2026
@lygav lygav changed the title Fix containerapp up --source crash: resolve OS/Architecture models from correct SDK package [ContainerApp] Fix az containerapp up --source crash: resolve OS/Architecture models from correct SDK package May 13, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a crash in az containerapp up --source during ACR build queuing by resolving OS, Architecture, DockerBuildRequest, and PlatformProperties from the correct SDK (azure-mgmt-containerregistrytasks) via ResourceType.MGMT_CONTAINERREGISTRYTASKS, avoiding cmd.get_models() returning None.

Changes:

  • Update queue_acr_build() to load OS/Architecture models from MGMT_CONTAINERREGISTRYTASKS instead of MGMT_CONTAINERREGISTRY.
  • Update queue_acr_build() to load DockerBuildRequest/PlatformProperties models from MGMT_CONTAINERREGISTRYTASKS instead of MGMT_CONTAINERREGISTRY.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yonzhan yonzhan assigned yanzhudd and unassigned zhoxing-ms May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-observability-squad Auto-Assign Auto assign by bot ContainerApp customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az containerapp up --source crashes on macOS: OS is None causing OS.linux.value to fail

5 participants