Repository navigation
[Containerapp] BREAKING CHANGE: Normalize and validate Compose file inputs before deployment - #34334
Greedygre (Greedygre) wants to merge 1 commit into
Conversation
…tory Validate and canonicalize secret and environment file references before reading them, and load all service file inputs before cloud operations. Preserve parser behavior and add command-handler and CLI-dispatch regressions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Path validation incorrectly converts directory access failures into InvalidArgumentValueError instead of the promised FileOperationError, bypassing the command’s read-error handling.
1 open issue
What changed in this PR
This PR updates az containerapp compose create to validate and read local file inputs before accessing Azure resources. It introduces a breaking change requiring file references to remain within the Compose file’s directory.
Changes:
- Resolve and validate secret and environment-file paths relative to the Compose file.
- Read file inputs before managed-environment operations and deployment, preserving existing precedence and secret mapping.
- Document the restrictions and add command-handler and CLI-dispatch regression tests.
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_compose_file_paths.py |
Adds path validation, file-read, and CLI-dispatch regression tests. |
src/azure-cli/azure/cli/command_modules/containerapp/custom.py |
Validates and reads service files before Azure operations. |
src/azure-cli/azure/cli/command_modules/containerapp/_help.py |
Documents path restrictions and environment-file behavior. |
src/azure-cli/azure/cli/command_modules/containerapp/_compose_utils.py |
Adds path normalization, containment checks, and secret-reference validation. |
Review effort: Balanced
| except (OSError, ValueError) as ex: | ||
| raise InvalidArgumentValueError(f"Unable to resolve the file referenced by '{field}': {ex}") from ex |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
Greedygre (@Greedygre) CI is green, but the file-access error contract needs correction and the recording warning below needs disposition. Windows/runtime and deployment regression scenarios remain unverified. To addressTick each item as you address it.
Review detailsUpstream CI53/53 upstream checks completed and passed; there are no CI failures. This is upstream evidence, not an Agent live run. The bounded description does not establish separate author-run runtime evidence. Test validation
Static inspection of These are Focused local rerun: Risk assessment45/100 · Medium The Medium rating is driven by security-sensitive behavior, public CLI behavior.
Ask the Agent Tick a box to queue an action. Requires write access to this repository.
|
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
Adding mansoor sarfraz (@msarfraz) to help review this breaking change |

🤖 PR Validation — ❌ Action needed
❌AzureCLI-BreakingChangeTest
Please submit your Breaking Change Pre-announcement ASAP if you haven't already. Please note:
This PR adds warning or check suppressions. Fix the underlying warning where possible and justify each remaining suppression in a code comment or the PR description.
3 added suppressions
src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_compose_file_paths.pyself.skipTest('Creating symbolic links requires Windows developer mode or privilege.')src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_compose_file_paths.py@unittest.skipUnless(os.name == 'nt', 'Windows path semantics')src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_compose_file_paths.py@unittest.skipUnless(os.name == 'nt', 'Windows directory junctions')Related command
az containerapp compose createDescription
Make local file handling consistent for Compose deployments: resolve secret files and
env_fileentries relative to the Compose file's directory and validate them before deployment.Validate all services and read their local file inputs before accessing or creating a managed environment or deploying an app. Preserve the existing parser's environment-file precedence and secret mapping behavior, and surface file access and decoding failures as CLI file-operation errors.
Update command help and add regression coverage through the command handler and actual CLI dispatch. This PR changes core Azure CLI only.
Compatibility: absolute file references are no longer supported, even when they point inside the project. Relative file references are now consistently anchored to the Compose file's directory rather than the process working directory.
Testing Guide
Commands were run using the existing development virtualenv with
PYTHONPATHpointing to this checkout'ssrc\azure-cli,src\azure-cli-core,src\azure-cli-testsdk, andsrc\azure-cli-telemetry.Result: 19 passed, 3 skipped. The skips require Windows symbolic-link privilege. Windows junction and external-path tests passed. Real CLI dispatch tests use temporary configuration, isolate installed extensions, and block network calls.
Result: passed. Repository pylint excludes tests; the new test file was also checked explicitly:
Result: both passed.
Additional verification used an offline pytest harness for all Compose scenarios, with external network calls blocked and the third-party parser's existing class-level service-order state cleared between tests: 41 passed, 3 skipped, 4 failed. All four failures were reproduced with the unmodified baseline command handler: one Log Analytics workspace-name recording mismatch and three ACR API-version recording mismatches. No recordings or unrelated product code were changed to suppress these failures.
Real Azure deployment was not run.
History Notes
[Containerapp] BREAKING CHANGE:
az containerapp compose create: Require secret files and environment files to use relative paths within the Compose file's directoryThis 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.