Skip to content

fix(swarm): report failed service rollouts - #5218

Open
bestmaa wants to merge 2 commits into
Dokploy:canaryfrom
bestmaa:fix/3987-swarm-rollback-status
Open

fix(swarm): report failed service rollouts#5218
bestmaa wants to merge 2 commits into
Dokploy:canaryfrom
bestmaa:fix/3987-swarm-rollback-status

Conversation

@bestmaa

@bestmaa bestmaa commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Wait for an existing Swarm service update to reach its terminal state before marking the deployment complete.
  • Treat paused and rolled-back updates as deployment failures, including the latest failed task reason and exit code when available.
  • Bound the wait using the configured update and rollback timings, while preserving the existing create path and job-mode behavior.

Testing

  • pnpm typecheck
  • pnpm build
  • pnpm --filter dokploy exec vitest run --config __test__/vitest.config.ts __test__/server/swarm-update.test.ts __test__/server/mechanizeDockerContainer.test.ts (16 tests passed)
  • Biome check on all changed files
  • Real local Swarm verification: a healthy update reached completed, while an unhealthy update automatically rolled back and surfaced the failed task reason

Fixes #3987

Happy to adjust the polling states or failure details if you would prefer a different approach.

Greptile Summary

This PR waits for existing Swarm application-service updates to reach a terminal state and reports paused or rolled-back rollouts with task failure details.

  • Adds bounded polling and failure-detail helpers for Swarm updates.
  • Integrates rollout waiting into existing non-job service updates while preserving service creation and job-mode behavior.
  • Adds unit coverage for successful updates, stale status handling, rollback failures, timeouts, and builder integration.

Confidence Score: 3/5

The PR should not merge until rollout waits are correlated to the initiating update and valid configured rollouts cannot be prematurely failed by the fixed one-hour cap.

Concurrent direct service mutations can make the waiter attribute another update’s terminal state to the current deployment, while accepted long-duration Swarm settings can exceed the capped wait and produce false deployment failures.

Files Needing Attention: packages/server/src/utils/docker/swarm-update.ts and packages/server/src/utils/builders/index.ts

Reviews (1): Last reviewed commit: "fix(swarm): report failed service rollou..." | Re-trigger Greptile

Greptile also left 2 inline comments on this PR.

Context used (3)

Comment thread packages/server/src/utils/docker/swarm-update.ts
Comment thread packages/server/src/utils/docker/swarm-update.ts Outdated
@drago1520

Copy link
Copy Markdown

super excited

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Swarm deployment rollback not reflected in Dokploy UI (deployment appears successful even when tasks fail healthcheck)

2 participants