Repository navigation
Serialize Swarm UpdateConfig.MaxFailureRatio as a YAML number - #21512
Conversation
MaxFailureRatio was typed as string?, so the Docker Compose publisher emitted a double-quoted scalar (max_failure_ratio: "0.3") that Docker Swarm rejects with 'max_failure_ratio must be a number'. Change it to double?, matching the earlier Parallelism fix (#15566). Fixes #19000 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 -- 21512Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21512" |
Tests selector5 / 100 PR test projects · 3 PR jobs, from 3 changed files. Selected PR test projects (5 / 100)
Selected PR jobs (3)
How these were chosen — grouped by what changed🔧 📦 affected project 🧪 🧪 Job reasons
Selection computed for commit |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the change to serialize Docker Swarm’s maximum failure ratio as a YAML number.
No open issues 🎉
What changed in this PR
Fixes #19000 by making Docker Swarm’s UpdateConfig.MaxFailureRatio serialize as a YAML number rather than a quoted string that Docker rejects.
Changes:
- Changes
MaxFailureRatiofromstring?todouble?and clarifies its documentation. This intentionally breaks source and binary compatibility. - Updates the existing serialization test and snapshot to use and expect numeric
0.3.
| File | Description |
|---|---|
tests/Aspire.Hosting.Docker.Tests/Snapshots/DockerComposeTests.DockerSwarmUpdateConfigSerializedCorrectly.verified.yaml |
Expects an unquoted numeric failure ratio. |
tests/Aspire.Hosting.Docker.Tests/DockerComposeTests.cs |
Assigns a numeric value in the serialization test. |
src/Aspire.Hosting.Docker/Resources/ServiceNodes/Swarm/UpdateConfig.cs |
Changes the property to double? and documents the numeric requirement. |
Review effort: Balanced
|
CI note for head 916f4d9: attempt 1 of run 41155112085 had 3 failures, all in VS Code extension E2E and unrelated to this Docker Compose YAML change. I've rerun the failed jobs once.
🤖 Posted by AspireAgent (AI Agent) |
|
Are there any other yaml values like this in either docker or k8s? |
I checked both, and I don't see any others. Details: Docker Compose / Swarm ( shm_size: "64m"
stop_grace_period: "10s"
deploy.resources.limits/reservations: cpus: "0.5", memory: "512M"
deploy.restart_policy: delay: "5s", window: "30s"
secrets[]/configs[]: uid: "1000", gid: "1000"Kubernetes ( So this PR stays scoped to 🤖 Posted by AspireAgent (AI Agent) |
|
✅ No documentation update needed. docs_optional → bug_fix_restores_documented_behavior. No signals triggered. The PR changes |
## Summary <!-- Describe what this pull request changes and why. --> Document the three Aspire 17.0 breaking changes for Docker Swarm `MaxFailureRatio`, the Azure Cosmos DB `configureClientOptions` callback, and `ResourceUrlAnnotation.DisplayOrder`. Update the Cosmos DB client options example and the custom resource URL example to reflect the new APIs. ## Third-party links and affiliations <!-- List any third-party links added or changed by this pull request and disclose any material affiliation with the linked organizations, such as employment, sponsorship, or ownership. Write "None" if this pull request doesn't add or change third-party links. --> Added cross-repository references to [microsoft/aspire#21512](microsoft/aspire#21512), [microsoft/aspire#19349](microsoft/aspire#19349), and [microsoft/aspire#20637](microsoft/aspire#20637). Material affiliation was not provided. ## Validation <!-- List the checks you ran or explain why validation isn't needed. --> - `git diff --check` — passed. - `bun run dev -- --host 127.0.0.1` from `src/frontend` — rendered the What's new, Cosmos DB connection, and custom resource URL pages. The local `/api/live/` endpoint returned 404, so live updates were disabled in the preview. --------- Co-authored-by: Copilot App <[email protected]>
Description
Aspire.Hosting.Docker.Resources.ServiceNodes.Swarm.UpdateConfig.MaxFailureRatiowas typed asstring?. The Compose serializer (ForceQuotedStringsEventEmitter) double-quotes every string scalar, so the published file containedmax_failure_ratio: "0.3". Docker Swarm requires a number and rejects the file. The existing snapshot testDockerSwarmUpdateConfigSerializedCorrectlyhad locked in the quoted (invalid) output.Fix: change
MaxFailureRatiotodouble?so it's emitted as a plain YAML number. This follows the siblingParallelismstring?→int?fix in #15566 and the type suggested in the issue. The test and snapshot now use0.3and expectmax_failure_ratio: 0.3.Compatibility note: this is a source/binary-breaking type change on a public property. The previous type could only ever produce Swarm-invalid output, so it's justified, as #15566 was. Local
dotnet packpackage validation passes (the 13.6.2 baseline only shipsnet8.0, which is ignored). Noapi/*.csedits, per repo guidance. The property isn't part of the ATS/polyglot export.Reproduction and evidence (local, Docker 29.1.3)
main13b2068)docker stack config -c docker-compose.yamlon the publisher output fromDockerSwarmUpdateConfigSerializedCorrectlyservices.my-service.deploy.update_config.max_failure_ratio must be a numberdocker stack deployto a single-node swarm (E2E)docker service inspect→"MaxFailureRatio":0.3DockerSwarmUpdateConfigSerializedCorrectlywith the new snapshotmax_failure_ratio: "0.3", expected0.3Aspire.Hosting.Docker.Tests(full project)For the deploy step only, the network driver was swapped from
bridgetooverlay, because Swarm services can't attach tobridgenetworks; that's unrelated to this fix.update_configwas left untouched. Inspected spec after deploy:{"Parallelism":2,"Delay":10000000000,"FailureAction":"rollback","Monitor":5000000000,"MaxFailureRatio":0.3,"Order":"start-first"}Fixes #19000
Checklist
🤖 Posted by AspireAgent (AI Agent)