Skip to content

[Container Apps] Fix #10375: az containerapp show: Return exit code 3 when the resource is missing - #10376

Closed
Aditya Pujara (a0x1ab) wants to merge 5 commits into
Azure:mainfrom
a0x1ab:agent-assist/azure-azure-cli-extensions-issue-10375-f4e88dbca3ba
Closed

Aditya Pujara (a0x1ab) wants to merge 5 commits into
Azure:mainfrom
a0x1ab:agent-assist/azure-azure-cli-extensions-issue-10375-f4e88dbca3ba

Conversation

@a0x1ab

@a0x1ab Aditya Pujara (a0x1ab) commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

🤖 PR Validation — ️✔️ All clear

Breaking Changes
️✔️ None

Description

Fixes #10375.

Return exit code 3 when the resource is missing.

This behavior applies to az containerapp show and az containerapp env show.


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

Related command

az containerapp show
az containerapp env show

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install azdev required)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

@x-engineering-agent x-engineering-agent Bot added the Request X Engineering Agent Ask the agent to triage this issue or review this PR label Sep 21, 2026
@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi Aditya Pujara (@a0x1ab),
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in pyproject.toml (or setup.py, if the extension has not migrated yet) as well.

@x-engineering-agent

Copy link
Copy Markdown

Live test results — azdev test --live --series (changed test files only)

✅ PASS

Selectors: azext_containerapp.test_containerapp_show (extension)
PR head ref: agent-assist/azure-azure-cli-extensions-issue-10375-f4e88dbca3ba
PR head sha: 0ab4838fe9685e0ac275015b8a18ef09339c1324
PR base ref: main
New test files in PR: true

Changed test files run
src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py

New test files
src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/35659749195

Last 80 lines of azdev output

=============
| Run Tests |
=============


test index found: /home/runner/.azdev/env_config/home/runner/work/issue-sentinel/issue-sentinel/.venv/test_index/latest.json

Test on modules: azext_containerapp.test_containerapp_show

WARNING: RUNNING TESTS LIVE
The tests are set to run against current profile "latest"
============================= test session starts ==============================
platform linux -- Python 3.12.14, pytest-9.1.1, pluggy-1.6.0 -- /home/runner/work/issue-sentinel/issue-sentinel/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/runner/work/issue-sentinel/issue-sentinel/azure-cli-extensions
configfile: pytest.ini
plugins: forked-1.7.5, xdist-3.8.0
collecting ... collected 10 items

azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::HandleShowExceptionTests::test_http_404_uses_status_instead_of_body PASSED [ 10%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::HandleShowExceptionTests::test_non_404_http_errors_keep_core_error_formatting PASSED [ 20%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::HandleShowExceptionTests::test_non_http_error_is_unchanged PASSED [ 30%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_containerapp_env_show_http_404 PASSED [ 40%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_containerapp_show_http_404 PASSED [ 50%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_containerapp_show_secrets_unchanged PASSED [ 60%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_show_non_404_http_errors_unchanged PASSED [ 70%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_show_non_http_errors_unchanged PASSED [ 80%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_show_success_unchanged PASSED [ 90%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_show_unstructured_non_404_http_error_unchanged PASSED [100%]

- generated xml file: /home/runner/work/issue-sentinel/issue-sentinel/test-output/results.xml -
============================== 10 passed in 4.03s ==============================

Posted by the X Engineering Agent live-test workflow.

@yonzhan

Copy link
Copy Markdown
Collaborator

Container Apps

@x-engineering-agent

Copy link
Copy Markdown

Live test results — azdev test --live --series (changed test files only)

✅ PASS

Selectors: azext_containerapp.test_containerapp_show (extension)
PR head ref: agent-assist/azure-azure-cli-extensions-issue-10375-f4e88dbca3ba
PR head sha: 5903ed0f58e11e5e813dcd50017c0c45fc09b582
PR base ref: main
New test files in PR: true

Changed test files run
src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py

New test files
src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/35676238254

Last 80 lines of azdev output

=============
| Run Tests |
=============


test index found: /home/runner/.azdev/env_config/home/runner/work/issue-sentinel/issue-sentinel/.venv/test_index/latest.json

Test on modules: azext_containerapp.test_containerapp_show

WARNING: RUNNING TESTS LIVE
The tests are set to run against current profile "latest"
============================= test session starts ==============================
platform linux -- Python 3.12.14, pytest-9.1.1, pluggy-1.6.0 -- /home/runner/work/issue-sentinel/issue-sentinel/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/runner/work/issue-sentinel/issue-sentinel/azure-cli-extensions
configfile: pytest.ini
plugins: forked-1.7.5, xdist-3.8.0
collecting ... collected 10 items

azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::HandleShowExceptionTests::test_http_404_uses_status_instead_of_body PASSED [ 10%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::HandleShowExceptionTests::test_non_404_http_errors_keep_core_error_formatting PASSED [ 20%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::HandleShowExceptionTests::test_non_http_error_is_unchanged PASSED [ 30%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_containerapp_env_show_http_404 PASSED [ 40%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_containerapp_show_http_404 PASSED [ 50%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_containerapp_show_secrets_unchanged PASSED [ 60%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_show_non_404_http_errors_unchanged PASSED [ 70%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_show_non_http_errors_unchanged PASSED [ 80%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_show_success_unchanged PASSED [ 90%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_show_unstructured_non_404_http_error_unchanged PASSED [100%]

- generated xml file: /home/runner/work/issue-sentinel/issue-sentinel/test-output/results.xml -
============================== 10 passed in 3.63s ==============================

Posted by the X Engineering Agent live-test workflow.

@x-engineering-agent

Copy link
Copy Markdown

Live test results — azdev test --live --series (changed test files only)

✅ PASS

Selectors: azext_containerapp.test_containerapp_show (extension)
PR head ref: agent-assist/azure-azure-cli-extensions-issue-10375-f4e88dbca3ba
PR head sha: cef9805cfd6d9ad58d3e408dad8cc32fdbf6e503
PR base ref: main
New test files in PR: true

Changed test files run
src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py

New test files
src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/35684830142

Last 80 lines of azdev output

=============
| Run Tests |
=============


test index found: /home/runner/.azdev/env_config/home/runner/work/issue-sentinel/issue-sentinel/.venv/test_index/latest.json

Test on modules: azext_containerapp.test_containerapp_show

WARNING: RUNNING TESTS LIVE
The tests are set to run against current profile "latest"
============================= test session starts ==============================
platform linux -- Python 3.12.14, pytest-9.1.1, pluggy-1.6.0 -- /home/runner/work/issue-sentinel/issue-sentinel/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/runner/work/issue-sentinel/issue-sentinel/azure-cli-extensions
configfile: pytest.ini
plugins: forked-1.7.5, xdist-3.8.0
collecting ... collected 10 items

azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::HandleShowExceptionTests::test_http_404_uses_status_instead_of_body PASSED [ 10%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::HandleShowExceptionTests::test_non_404_http_errors_keep_core_error_formatting PASSED [ 20%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::HandleShowExceptionTests::test_non_http_error_is_unchanged PASSED [ 30%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_containerapp_env_show_http_404 PASSED [ 40%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_containerapp_show_http_404 PASSED [ 50%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_containerapp_show_secrets_unchanged PASSED [ 60%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_show_non_404_http_errors_unchanged PASSED [ 70%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_show_non_http_errors_unchanged PASSED [ 80%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_show_success_unchanged PASSED [ 90%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_show_unstructured_non_404_http_error_unchanged PASSED [100%]

- generated xml file: /home/runner/work/issue-sentinel/issue-sentinel/test-output/results.xml -
============================== 10 passed in 4.50s ==============================

Posted by the X Engineering Agent live-test workflow.

x-engineering-agent[bot]

This comment was marked as low quality.

@x-engineering-agent x-engineering-agent Bot added the X Engineering Agent Reviewed Agent reviewed this PR label Sep 22, 2026
x-engineering-agent[bot]

This comment was marked as low quality.

@x-engineering-agent x-engineering-agent Bot removed the Request X Engineering Agent Ask the agent to triage this issue or review this PR label Sep 22, 2026
@x-engineering-agent
x-engineering-agent Bot marked this pull request as ready for review September 22, 2026 07:44
Copilot AI lite review requested due to automatic review settings September 22, 2026 07:44
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Restore broad exception handling in both affected show-command paths to avoid regressions for non-404 errors.

Review effort: Lite
Findings: None

What changed in this PR

Updates Container Apps show commands to return exit code 3 when resources are missing.

Changes:

  • Convert HTTP 404 responses to ResourceNotFoundError.
  • Add app and environment show-command tests.
  • Bump the extension version and update release history.
File Summary
src/​containerapp/​setup.py Bumps extension version.
src/​containerapp/​HISTORY.rst Documents the behavior change.
src/​containerapp/​azext_containerapp/​tests/​latest/​test_containerapp_show.py Adds show-command error and regression tests.
src/​containerapp/​azext_containerapp/​custom.py Applies custom 404 handling; exception handling should preserve prior normalization for non-404 failures.
src/​containerapp/​azext_containerapp/​_client_factory.py Converts HTTP 404 responses to resource-not-found errors.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@x-engineering-agent

Copy link
Copy Markdown

Live test results — azdev test --live --series (changed test files only)

✅ PASS

Selectors: azext_containerapp.test_containerapp_show (extension)
PR head ref: agent-assist/azure-azure-cli-extensions-issue-10375-f4e88dbca3ba
PR head sha: 39c638558e89f456ac4f05e2cc3ecd0944645d48
PR base ref: main
New test files in PR: true

Changed test files run
src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py

New test files
src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/35702711643

Last 80 lines of azdev output

=============
| Run Tests |
=============


test index found: /home/runner/.azdev/env_config/home/runner/work/issue-sentinel/issue-sentinel/.venv/test_index/latest.json

Test on modules: azext_containerapp.test_containerapp_show

WARNING: RUNNING TESTS LIVE
The tests are set to run against current profile "latest"
============================= test session starts ==============================
platform linux -- Python 3.12.14, pytest-9.1.1, pluggy-1.6.0 -- /home/runner/work/issue-sentinel/issue-sentinel/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/runner/work/issue-sentinel/issue-sentinel/azure-cli-extensions
configfile: pytest.ini
plugins: forked-1.7.5, xdist-3.8.0
collecting ... collected 10 items

azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::HandleShowExceptionTests::test_http_404_uses_status_instead_of_body PASSED [ 10%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::HandleShowExceptionTests::test_non_404_http_errors_keep_core_error_formatting PASSED [ 20%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::HandleShowExceptionTests::test_non_http_error_is_unchanged PASSED [ 30%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_containerapp_env_show_http_404 PASSED [ 40%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_containerapp_show_http_404 PASSED [ 50%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_containerapp_show_secrets_unchanged PASSED [ 60%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_show_non_404_http_errors_unchanged PASSED [ 70%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_show_non_http_errors_unchanged PASSED [ 80%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_show_success_unchanged PASSED [ 90%]
azure-cli-extensions/src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py::ContainerappShowTests::test_show_unstructured_non_404_http_error_unchanged PASSED [100%]

- generated xml file: /home/runner/work/issue-sentinel/issue-sentinel/test-output/results.xml -
============================== 10 passed in 4.17s ==============================

Posted by the X Engineering Agent live-test workflow.

x-engineering-agent[bot]

This comment was marked as low quality.

@x-engineering-agent

Copy link
Copy Markdown

Closing this PR as stale: it had no human activity for 30 days. It changed src/containerapp/HISTORY.rst, src/containerapp/azext_containerapp/_client_factory.py, src/containerapp/azext_containerapp/custom.py, src/containerapp/azext_containerapp/tests/latest/test_containerapp_show.py, src/containerapp/setup.py. The Agent will rework #10375 from a fresh analysis on the current base branch and link the new PR here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[containerapp] "az containerapp show" does not return exit code 3 when the Container App does not exist

4 participants