Repository navigation
Merge App Service sticky slot settings into user-defined SlotConfigNames - #21457
Conversation
AddStickySlotSettings always declared a new 'slotConfigNames' resource, so a SlotConfigNames added in a PublishAsAzureAppServiceWebsite customization produced a duplicate Bicep identifier (BCP028/BCP121) and deployment failed. Merge the generated sticky app setting names into the existing resource for the same site instead. Fixes #21236 Co-authored-by: Copilot <[email protected]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21457Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21457" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
Expression-backed sticky-setting lists still cause publishing failures, and the tests do not verify that generated names are merged into the sticky-settings array.
2 open issues
What changed in this PR
Addresses #21236 by merging Aspire-generated sticky App Service settings into a user-defined SlotConfigNames resource instead of creating a duplicate Bicep resource.
Changes:
- Reuses an existing
SlotConfigNamesfor the same site and skips duplicate literal setting names. - Adds regression coverage with and without an environment deployment slot.
| File | Description |
|---|---|
| tests/Aspire.Hosting.Azure.Tests/AzureAppServiceTests.cs | Adds theory cases for merging user-defined and generated sticky settings. |
| src/Aspire.Hosting.Azure.AppService/AzureAppServiceWebsiteContext.cs | Finds and extends an existing site-specific SlotConfigNames resource. |
Review effort: Balanced
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
…tput Address review feedback: compose parameter/expression-backed AppSettingNames with Bicep union() instead of appending (which throws), and verify the merged slotConfigNames via parameterized Bicep snapshots. Co-authored-by: Copilot <[email protected]>
Tests selector3 / 100 PR test projects · 2 PR jobs, from 6 changed files. Selected PR test projects (3 / 100)
Selected PR jobs (2)
How these were chosen — grouped by what changed🔧 🧪 🧪 🧪 🧪 🧪 Job reasons
Selection computed for commit |
#21457 added snapshots that predate the resourceId and resourceLocation outputs from #21396. Co-authored-by: Copilot App <[email protected]>
<!-- copilot-assessment:v1 --> ### Agent assessment Self-reported assessment, not an independent review. Assessed revision: `a4a7fdc6e14c767da40d1a8cac4598d40a29ed78` | Dimension | Assessment | Rationale | |---|---|---| | Change confidence | 8.5/10 | ↑ All 14 image-build harness scenarios pass on Linux (node 24), including new pre-deadline and cleanup Docker/plugin 255 cases, which fail without the fix.<br>↑ DcpConnectionHealthCheckTests builds; the repaired test passes locally.<br>↑ All 61 AzureAppServiceTests pass locally with updated snapshots.<br>↓ Two DcpConnectionHealthCheckTests string assertions fail locally only due to a Spanish UI culture.<br>↓ Post-push CI not yet inspected at time of assessment. | | Diagnosis confidence | 9/10 | ↑ docker/cli v28.0.4 propagates WaitStatus.ExitStatus() (-1 for signaled plugins, exit 255).<br>↑ CI log shows CS7036 at DcpConnectionHealthCheckTests.cs:208-209 matching the #22553 signatures. | | Evidence fit | 8.5/10 | ↑ Regression reproduces the reviewer's fallback-and-exit-0 symptom.<br>↓ Not validated against a real Buildx plugin kill. | <!-- /copilot-assessment --> ## Description Shared CLI E2E image builds can exhaust their 45-minute job downloading from a throttled Azure Ubuntu apt mirror without reaching the existing error-only fallback. Bound primary attempts so default-source fallback also runs for slow or stalled builds. Independent fix based on `main`; relates to #21828, which is unchanged and is not a dependency. No auto-merge or bypass requested. - Share orchestration across the reusable image workflow and cache warmer. Apply a five-minute primary limit to .NET, polyglot base, Java and Go. Four primary attempts plus four 30-second cleanup grace periods leave 23 minutes within the unchanged 45-minute cap for fallback, setup and artifact handling. - TERM the client's process group so Docker can cancel its BuildKit session. Retry exactly once after ordinary failure or deadline, preserving both attempts' output and fallback status. A dependency-free Node supervisor tracks deadline and external signals independently, including cancellation during cleanup. External cancellation and forced kills, including an independently killed client, fail without fallback. - Preserve original Ubuntu apt sources and restore them for empty mirror arguments, including inherited Java/Go layers. Leave third-party sources untouched. - Add behavioral regressions, test-selection routes, cache-warmer filters and docs. No action pins, package manifests or product code changed. - Treat Docker exit 255 (a CLI plugin such as Buildx killed by a signal) as unconfirmed cancellation, before or during deadline cleanup, so it fails without fallback. - Fix the `main` build break in `tests/Aspire.Cli.Tests/Utils/DcpConnectionHealthCheckTests.cs`: the test added by #21919 used the pre-#22553 `CertificateManager.Create` and `DcpConnectionChecker` signatures (CS7036). It now passes `TemporaryStorage` like neighboring tests. - Fix the `main` test break in `AzureAppServiceTests.UserDefinedSlotConfigNames_AreMergedWithGeneratedStickySettings`: the snapshots from #21457 predate the `resourceId`/`resourceLocation` outputs added by #21396. ### Two-attempt root-cause evidence Both jobs ran at #21828 head `1ab3ad1e302a110bdb4f69ad4e3ee2e05d646d9a` in [run 42151619597](https://github.com/microsoft/aspire/actions/runs/42151619597). Both have annotation `The job has exceeded the maximum execution time of 45m0s`. | Attempt | Image job | Started / completed (UTC, November 6) | Exact apt log | | --- | --- | --- | --- | | 1 | [127676748230](https://github.com/microsoft/aspire/actions/runs/42151619597/job/127676748230) | 02:41:00 / 03:26:22 | `#11 2272.6 Fetched 82.4 MB in 37min 49s (36.3 kB/s)` | | 2 | [127692798471](https://github.com/microsoft/aspire/actions/runs/42151619597/job/127692798471) | 03:29:03 / 04:14:24 | `#11 2492.6 Fetched 108 MB in 41min 29s (43.4 kB/s)` | Attempt 2 then downloaded from HTTPS GitHub at `#11 2497.2 Fetched 15.1 MB in 0s (80.1 MB/s)`, while another mirror download logged `#15 92.37 Fetched 4031 kB in 1min 29s (45.4 kB/s)`. Both also reported GHA cache-import HTTP 400, `Our services aren't available right now`. Cold apt downloads, not product tests, consumed the image job. Neither attempt reached product-test execution using these images. No third rerun was triggered. ### Local validation `.\restore.cmd`: passed, 0 errors and 18 dependency-advisory warnings. Original selector coverage passed across appropriate hosts: 299 Windows managed cases, 2 Windows native MSBuild graph cases and 79 Linux shell/Git cases: ```powershell dotnet test --project tests\Infrastructure.Tests\Infrastructure.Tests.csproj --no-launch-profile -- --filter-namespace "Infrastructure.Tests.TestTriggerMap" --filter-not-class "*.PrComparisonBaseTests" --filter-not-class "*.SelectTestsCliTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" # Passed: 299 dotnet test --project tests\Infrastructure.Tests\Infrastructure.Tests.csproj --no-launch-profile -- --filter-method "*.NativeDashboardSharedHelpersSelectNativeValidationInEnforceMode" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" # Passed: 2 dotnet test --project tests\Infrastructure.Tests\Infrastructure.Tests.csproj --no-launch-profile -- --filter-class "*.TestTriggerMapTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" # Passed: 179 after the final routing change dotnet run --project tools\SelectTests -- --changed-files <generated-changed-files.txt> --explain # Passed: production graph/prefilter, 0 unattributed inputs. # Shared Docker shell helper correctly activates the existing ALL route. ``` Linux container, pinned .NET runtime, same built MTP assembly: ```bash /tmp/dotnet/dotnet /repo/artifacts/bin/Infrastructure.Tests/Debug/net11.0/Infrastructure.Tests.dll --filter-class "*.PrComparisonBaseTests" --filter-class "*.CliE2EImageBuildTests" --filter-class "*.SelectTestsCliTests" --filter-not-method "*.NativeDashboardSharedHelpersSelectNativeValidationInEnforceMode" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" --results-directory /tmp/test-results # Original implementation: passed 88 (79 selector + 9 image cases). /tmp/dotnet/dotnet artifacts/bin/Infrastructure.Tests/Debug/net11.0/Infrastructure.Tests.dll --filter-class "*.CliE2EImageBuildTests" --filter-not-trait quarantined=true --filter-not-trait outerloop=true # Final b8274fc: passed all 13 expanded image cases. ``` The initial Windows run failed in 17 shell cases because it selected the broken System32 WSL bash shim, and 5 existing Git-fixture cleanup cases with `UnauthorizedAccessException`. The same cases passed on Linux. The 2 native graph cases passed on Windows; running the Windows SDK on Linux caused `BadImageFormatException`. Passing partitions cover every focused case without modifying unrelated tests. The 13 image cases cover success, ordinary failure, fallback failure, slow success, stall, forced kill, client cancellation, external cancellation before/during deadline cleanup, client SIGKILL during cleanup, all-image/.NET-only orchestration, and exact original apt-source restoration in real Ubuntu. Cleanup cancellation reproduces on 4bb054c as incorrect exit 0 plus fallback; the corrected supervisor exits 143 without fallback. Killed clients retain 137, never deadline 124. Real Docker/Buildx probe re-run after the supervisor change: ```bash build_with_mirror_retry 20s "real BuildKit cancellation probe" docker buildx build --progress plain --load -t mirror-fallback-probe ``` Passed: primary printed `PRIMARY_RUNNING`, then `#5 CANCELED` / `Canceled: context canceled`; fallback printed `FALLBACK_RUNNING` and loaded the image. BuildKit history recorded primary `Error` and fallback `Completed`. Process inspection before fallback and afterwards found only the BuildKit daemon, no surviving primary `RUN`/`sleep`. Temporary builder and image removed. `git diff --check`: passed. ### Actual final-head CI Head **b8274fc8e0377c70ada8aa9eecfbdbc4069c6ff7**, [run 42170803717](https://github.com/microsoft/aspire/actions/runs/42170803717): **image build and all four uploads passed; Infrastructure passed 2090/2090; all 116 selected CLI archive E2E jobs passed.** The downloaded Infrastructure TRX confirms all 13 new image cases passed. CLI unit tests passed on Linux, macOS and Windows. This is actual final-head evidence, not evidence from superseded runs. [Image job 127739541935](https://github.com/microsoft/aspire/actions/runs/42170803717/job/127739541935) ran 05:56:03–06:05:32 UTC. All four artifacts are present and unexpired: | Variant | Artifact ID | Size (bytes) | Uploaded UTC | | --- | --- | --- | --- | | .NET | 13481517063 | 696399767 | 06:04:42 | | Polyglot | 13480867983 | 391644472 | 06:04:54 | | Java | 13481671757 | 654944092 | 06:05:13 | | Go | 13481043964 | 583388699 | 06:05:30 | The primary mirror was healthy: `#11 4.388 Fetched 108 MB in 1s (114 MB/s)`. **No actual CI timeout/fallback occurred**; fallback evidence is deterministic/local BuildKit evidence, not a production CI claim. Representative actual consumers confirm all four artifacts load and execute tests: | Consumer job | Images loaded | Test outcome | | --- | --- | --- | | [Go starter 127743182589](https://github.com/microsoft/aspire/actions/runs/42170803717/job/127743182589) | .NET, polyglot, Go | 1 passed, 1 skipped | | [Java polyglot 127743185239](https://github.com/microsoft/aspire/actions/runs/42170803717/job/127743185239) | .NET, polyglot, Java | 1 passed | | [.NET smoke 127743188570](https://github.com/microsoft/aspire/actions/runs/42170803717/job/127743188570) | .NET, polyglot | 10 passed | **Required checks are not green; approval is still required.** Two failures outside the changed image infrastructure remain, with same-source main controls rather than blind reruns: - [Windows extension units 127739542026](https://github.com/microsoft/aspire/actions/runs/42170803717/job/127739542026): 4150 passed, 9 pending, 1 failed. `rejects when a POSIX process group remains alive after forced termination` passed its rejection/listener assertions but saw global fake-timer count 2 instead of 0. Test and process-helper blobs are identical to main 54b4929. [Main control 127718292677](https://github.com/microsoft/aspire/actions/runs/42164303520/job/127718292677) passed that exact case and all 4151 tests. The source of the two timers is not established; no extension edit or retry made. - [Windows Hosting-2 127739572340](https://github.com/microsoft/aspire/actions/runs/42170803717/job/127739572340): `ExecutableDoesNotExist` and `ExecutableWorkingDirectoryDoesNotExist` failed before scenario assertions because DCP's `docker.exe --version` dependency probe timed out. Test file and entire DCP source tree are identical to main 54b4929. [Main control 127718297752](https://github.com/microsoft/aspire/actions/runs/42164303520/job/127718297752) TRX passed the same cases in 6.005s and 2.854s. No product edit or retry made. All four review threads have been addressed. No merge or bypass performed; #21828 remains untouched and cannot consume this fix until integration. ### Security considerations The supervisor executes existing checked-in Docker commands, not new untrusted input. Separate-session process-group signaling avoids signaling the workflow shell and permits child cleanup. A forced kill cannot confirm remote BuildKit cancellation, so it fails closed without fallback. No threat model or separate security review has been performed. Fixes # (issue) ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes - [ ] No - Did you add public API? - [ ] Yes - If yes, did you have an API Review for it? - [ ] Yes - [ ] No - Did you add `<remarks />` and `<code />` elements on your triple slash comments? - [ ] Yes - [ ] No - [x] No - Does the change make any security assumptions or guarantees? - [x] Yes - If yes, have you done a threat model and had a security review? - [ ] Yes - [x] No - [ ] No --------- Co-authored-by: IEvangelist <[email protected]> Co-authored-by: Copilot App <[email protected]> Co-authored-by: Adam Ratzman <[email protected]>

Description
Fixes #21236
Users could not configure their own sticky (slot-specific) App Service settings. Adding a
SlotConfigNamesresource in aPublishAsAzureAppServiceWebsitecustomization callback, as in the issue, produced a secondresource slotConfigNamesdeclaration in the generated Bicep. Deployment then failed withBCP028: Identifier "slotConfigNames" is declared multiple times/BCP121.Root cause
AzureAppServiceWebsiteContext.AddStickySlotSettingsalways creates and adds a newSlotConfigNames("slotConfigNames")for the site. It does this whenever Aspire has its own sticky names, such asOTEL_SERVICE_NAMEwhen the dashboard is enabled, or endpoint reference settings. It runs after the user customization callbacks, so a resource the user added for the same site was duplicated instead of extended. A site can only have oneslotConfigNamesconfig resource.Fix
AddStickySlotSettingsnow looks for an existingSlotConfigNameswhoseParentis the same site. If it finds one, it merges Aspire's sticky names into it:ProvisioningParameter, where appending would throw): the list is replaced with a variableunion(<original>, [<generated names>]).If there is no existing resource, it creates one as before. This gives the behaviour the issue asks for: "define my own sticky slot app settings and have them merge with the defaults." The generated Bicep is unchanged when the user doesn't add
SlotConfigNames; all existing snapshot tests pass unchanged.Regression test
AzureAppServiceTests.UserDefinedSlotConfigNames_AreMergedWithGeneratedStickySettingsfollows the issue's repro: a userSlotConfigNamesadded in the customization callback. It's parameterized bywithDeploymentSlotandparameterBackedNames. It asserts there is exactly oneresource slotConfigNamesdeclaration, and verifies Bicep snapshots that show Aspire'sOTEL_SERVICE_NAMEmerged intoappSettingNames, either appended or viaunion().All 4 snapshots compile with the Bicep CLI (
bicep build).main(a76b57a)Assert.Single() Failure: The collection contained 2 items(duplicateslotConfigNames, i.e. BCP028/BCP121)Related suites run locally with the fix:
*AppService*classes (AzureAppServiceTests,AzureAppServiceEnvironmentExtensionsTests): 71/71 pass.AzureDeployerTests: 53/53 pass.Checklist
🤖 Posted by AspireAgent (AI Agent)