Fixing bugs for sticky slot app settings#13693
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13693Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 13693" |
src/Aspire.Hosting.Azure.AppService/AzureAppServiceWebsiteContext.cs
Outdated
Show resolved
Hide resolved
…cky app settings for deployment slots.
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug where Azure App Service deployment slot settings were not correctly configured as "sticky" (slot-specific), causing telemetry and app service dependencies to get mixed up after slot swaps. The fix ensures that OTEL_SERVICE_NAME and service dependency app settings remain specific to each deployment slot and do not swap during slot operations.
Key Changes
- Updated
Azure.Provisioning.AppServicepackage from version 1.3.0 to 1.3.1 to supportSlotConfigNamesconfiguration - Added
SlotConfigNamesresource creation to mark specific app settings as sticky to deployment slots - Automatically marks
OTEL_SERVICE_NAMEand all app service endpoint reference settings as slot-sticky - Fixed hostname generation logic to properly truncate web app and slot names (max 40 chars for prefix when using slots, 59 chars total with slot suffix)
- Refactored dashboard and Application Insights configuration methods to accept app settings lists directly instead of web site objects, reducing code duplication
- Fixed typo: renamed
computerEnvtocomputeEnvthroughout the codebase
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
Directory.Packages.props |
Updates Azure.Provisioning.AppService package version from 1.3.0 to 1.3.1 |
src/Aspire.Hosting.Azure.AppService/AzureAppServiceWebsiteContext.cs |
Core implementation: adds SlotConfigNames resource, marks OTEL_SERVICE_NAME and endpoint references as sticky, refactors configuration methods |
src/Aspire.Hosting.Azure.AppService/AzureAppServiceWebSiteResource.cs |
Fixes typo (computerEnv→computeEnv), improves hostname truncation logic with proper constants |
tests/Aspire.Hosting.Azure.Tests/Snapshots/*.verified.bicep (17 files) |
Updates test snapshots to include new slotConfigNames resource with appropriate sticky app settings |
src/Aspire.Hosting.Azure.AppService/AzureAppServiceWebsiteContext.cs
Outdated
Show resolved
Hide resolved
src/Aspire.Hosting.Azure.AppService/AzureAppServiceWebsiteContext.cs
Outdated
Show resolved
Hide resolved
eerhardt
left a comment
There was a problem hiding this comment.
I just had some minor comments/feedback. This looks good.
src/Aspire.Hosting.Azure.AppService/AzureAppServiceWebSiteResource.cs
Outdated
Show resolved
Hide resolved
|
/backport to release/13.1 |
|
Started backporting to release/13.1: https://github.com/dotnet/aspire/actions/runs/20830264615 |
Description
Current behavior
When an Aspire project is deployed, all the app service and slots are deployed with app settings that are not sticky to the deployment slots. When slot swap is done, the app settings also get swapped as expected.
This results in incorrect behavior for these cases:
Description of the fix
SlotConfigNames.Fixes #13660
Checklist
<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplate