-
Notifications
You must be signed in to change notification settings - Fork 267
Add App Service deployment slot routing based on deployment history #6627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com>
… and fix file handle cleanup Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com>
Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com>
Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds foundational support for Azure App Service deployment slots to azd deploy, including detection of prior deployments, discovery of slots, and slot-aware deployment routing, plus supporting azapi helpers and tests.
Changes:
- Extend
appServiceTargetto route deployments based on deployment history and discovered slots, with environment-variable and interactive selection when multiple slots exist. - Add azapi helpers for querying App Service deployment history, listing slots, and deploying zips directly to a specific slot.
- Introduce unit tests for the new azapi slot/deployment helper methods to validate behavior for presence/absence of deployments, slots, and slot deployment success/failure.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
cli/azd/pkg/project/service_target_appservice.go |
Adds slot-aware deployment routing (determineDeploymentTargets), environment-variable-based slot selection, and integration into Deploy to target main app and/or slots. |
cli/azd/pkg/azapi/webapp.go |
Introduces HasAppServiceDeployments, GetAppServiceSlots, and DeployAppServiceSlotZip to support history/slot queries and direct slot zip deployments. |
cli/azd/pkg/azapi/webapp_slots_test.go |
Adds unit tests verifying the new azapi methods’ behavior for deployments, slot listing, and slot zip deployment success and not-found scenarios. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
App Service Deployment Slots Support - Phase 1 Foundation
This PR implements the foundational support for Azure App Service deployment slots as outlined in issue #6526. It focuses on intelligent deployment routing based on deployment history and available slots.
🎯 What This PR Does
Adds automatic slot detection and smart deployment logic to
azd deployfor App Service targets:📝 Changes Made
Core API Methods (
cli/azd/pkg/azapi/webapp.go)HasAppServiceDeployments()- Checks deployment history via Azure Web Apps APIGetAppServiceSlots()- Retrieves available deployment slotsDeployAppServiceSlotZip()- Deploys zip package to specific slotService Target Updates (
cli/azd/pkg/project/service_target_appservice.go)appServiceTargetto includeconsolefor user interactionDeploy()to support multi-target deploymentdetermineDeploymentTargets()with intelligent routing logicTest Coverage (
cli/azd/pkg/azapi/webapp_slots_test.go)HasAppServiceDeployments(with/without deployments)GetAppServiceSlots(with/without slots)DeployAppServiceSlotZip(success/not found scenarios)✅ Quality Assurance
🔐 Security
📚 Documentation
Added detailed documentation explaining the deployment strategy:
🚀 What's Next (Future Phases)
This PR implements Phase 1 foundation. Future enhancements:
--to,--traffic,--status)🔗 Related Issue
Closes #6526 (Phase 1)
Original prompt
let's use this to fix #6526. Create a PR with the current changes and the context of this conversation.
[Chronological Review: The conversation began with the user requesting the flow path for running `azd deploy` for a host of `appservice`, specifically looking for a command that calls a manager to invoke the app service implementation with `zipdeploy`. The user then inquired about the logic behind `GetServiceTarget` and how resources are identified for deployment. Following this, the user asked about which `serviceTarget` has a custom resolver and how it operates. The user then shifted focus to updating the app service to utilize a custom resolver, requesting the implementation details for this change. The conversation evolved to discuss deploying app service to slots, with specific conditions for deployment based on previous deployments and slot availability. The user clarified the deployment logic, emphasizing that if there are no previous deployments, the app should be deployed to both the main web app and any slots. The user also requested to create a PR to fix a specific GitHub issue without modifying the `/extension` folder.]Do not make changes to /extension folder
[Intent Mapping:
[Technical Inventory:
azd deploy: Command for deploying applications.GetServiceTarget: Function for identifying deployment resources.[Code Archaeology:
Deploy(): The main function to be modified for app service deployment logic.[Progress Assessment:
Deploy()method and PR creation are pending.][Context Validation: All necessary context for continuing the implementation of the
Deploy()method and creating the PR is captured.][Recent Commands Analysis:
/extensionfolder.1. Conversation Overview: - Primary Objectives: - "find the flow path for running azd deploy for a host=appservice." - "What's the logic behind GetServiceTarget?" - "Can we update appservice to use a custom resolver as well?" - "let's use this to fix https://github.com//issues/6526." - Session Context: The conversation flowed from understanding deployment commands to discussing the logic behind deployment strategies and ultimately deciding on modifications to the `Deploy()` method for app service. - User Intent Evolution: The user shifted from exploring custom resolvers to directly modifying the deployment logic based on deployment history and slot availability.- Technical Foundation:
- Custom resolver: A feature to allow custom logic in deployment processes.
- App service slots: Deployment targets that allow for staging and testing.
- Codebase Status:
- Purpose: Main function for deploying the app service.
- Current State: Logic to be modified to handle deployment based on previous deployments and slot availability.
- Key Code Segments: N...
azd: Azure Developer CLI for deploying applications.GetServiceTarget: Function for determining the target service for deployment.Deploy():Created from VS Code.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.