feat: add configurable deploy timeout via --timeout flag and azure.yaml#7045
feat: add configurable deploy timeout via --timeout flag and azure.yaml#7045
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a user-configurable deployment timeout to azd deploy, allowing CI/pipelines to fail faster when Azure long-running deployments hang, using a CLI flag and per-service azure.yaml configuration.
Changes:
- Adds
--timeouttoazd deploywith precedence: flag >azure.yaml(deployTimeout) > default (1200s). - Wraps each service deploy operation in
context.WithTimeoutso Azure SDK polling honors the deadline. - Extends project config/schema/tests and updates CLI usage/completions snapshots.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/internal/cmd/deploy.go | Adds --timeout, resolves precedence, and applies context.WithTimeout around deploy. |
| cli/azd/internal/cmd/deploy_test.go | Adds tests for flag parsing, timeout resolution, and ensuring deploy uses a deadline. |
| cli/azd/pkg/project/service_config.go | Adds DeployTimeout *int to service config model. |
| cli/azd/pkg/project/service_config_test.go | Adds YAML parsing tests for deployTimeout. |
| cli/azd/pkg/project/project_config_test.go | Adds project-level parsing test for deployTimeout. |
| schemas/v1.0/azure.yaml.json | Adds deployTimeout schema property for services. |
| cli/azd/cmd/testdata/TestFigSpec.ts | Updates Fig completion spec snapshot to include --timeout. |
| cli/azd/cmd/testdata/TestUsage-azd-deploy.snap | Updates deploy usage snapshot to include --timeout. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
How can we communicate to folks that the timeout is only to stop azd but not the actual deployment? For AppService, for example, azd can be stopped, during zip deployment, before sending the zip file and starting the service deployment. That would be a valid cancellation in both sides. |
What I am going to change here is a global timeout setting for deployments instead of per service |
|
Regarding hemarina's feedback about per-service vs total timeout: the current implementation applies |
weikanglim
left a comment
There was a problem hiding this comment.
Overall looks good -- have some comments
- Remove .squad/ files from PR (hemarina) - Defer context cancel immediately after WithTimeout (Copilot) - Move timeout resolution before service loop (weikanglim) - Check deployCtx.Err() directly for unambiguous timeout detection (weikanglim) - Include --timeout/AZD_DEPLOY_TIMEOUT/azure.yaml in timeout error msg (weikanglim) - Fix flaky test timing by capturing start time before Run() (Copilot) - Remove reflection/t.Skip from tests, use direct field access (Copilot) - Add minimum:1 to deployTimeout in JSON schema (Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
wbreza
left a comment
There was a problem hiding this comment.
📋 Code Review — PR #7045
Good work on adding configurable deploy timeouts — this addresses a real pain point. The implementation is clean and the test coverage is thorough.
I did a cross-command analysis of timeout patterns across the codebase. This would be the first command with a timeout flag — no other command (provision, package, build, restore, up) has one. All Azure SDK PollUntilDone calls currently use nil options (no timeout). This is a good foundation but raises questions about cohesion across commands.
✅ What Looks Good
context.WithTimeoutpropagation throughPollUntilDoneis elegant — no custom polling needed- Timeout error message is excellent: tells users the deploy may still be running in Azure + how to increase
- 15 table-driven tests with good coverage of precedence, validation, and integration
- Schema updates in both v1.0 and alpha
Summary
| Priority | Count |
|---|---|
| High | 1 |
| Medium | 2 |
| Total | 3 |
Overall Assessment: Comment — the undocumented env var needs attention, and the naming/scope design deserves team input.
4b128df to
af837a0
Compare
Add --timeout flag and AZD_DEPLOY_TIMEOUT env var to azd deploy. Controls how long azd waits for each service deployment (default: 1200s). Timeout stops azd from waiting but does not cancel the Azure-side deployment. Precedence: --timeout flag > AZD_DEPLOY_TIMEOUT env var > default. Closes #6555 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
af837a0 to
992cf46
Compare
- Add 1.24.0-beta.1 unreleased section to cli/azd/CHANGELOG.md with entries for configurable deploy timeout (Azure#7045), git dirty check and workflow consent for azd init agent mode (Azure#7162), cobra command tree fix (Azure#7171), and input validation improvements (Azure#7175) - Bump cli/version.txt to 1.24.0-beta.1 - Add 0.1.16-preview section to agents CHANGELOG with entries for file operations (Azure#7141), input validation (Azure#7175), and breaking change for show/monitor commands (Azure#7181) - Bump agents version.txt and extension.yaml to 0.1.16-preview Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Problem
azd deployhas no user-configurable timeout. The Azure SDK default timeout is effectively unbounded for App Service and Container Apps deployments, making pipeline feedback loops slow when deployments hang (#6555).Solution
Add a
--timeoutflag toazd deployand adeployTimeoutfield inazure.yamlservice configuration:Timeout resolution order: CLI flag > azure.yaml service config > default (1200s / 20 min)
The timeout wraps the deploy context with
context.WithTimeout, which propagates through all Azure SDKPollUntilDonecalls naturally.Changes
cli/azd/internal/cmd/deploy.go--timeoutflag,resolveDeployTimeout(), apply viacontext.WithTimeoutcli/azd/internal/cmd/deploy_test.gocli/azd/pkg/project/service_config.goDeployTimeout *intfieldcli/azd/pkg/project/service_config_test.gocli/azd/pkg/project/project_config_test.goschemas/v1.0/azure.yaml.jsondeployTimeoutinteger propertycli/azd/cmd/testdata/TestFigSpec.tscli/azd/cmd/testdata/TestUsage-azd-deploy.snapTesting
go build ./...✅Fixes #6555