Skip to content

cli/command/service: preserve mount order on force update - #7227

Open
kawmy wants to merge 1 commit into
docker:masterfrom
kawmy:7226-preserve-mount-order
Open

cli/command/service: preserve mount order on force update#7227
kawmy wants to merge 1 commit into
docker:masterfrom
kawmy:7226-preserve-mount-order

Conversation

@kawmy

@kawmy kawmy commented Aug 21, 2026

Copy link
Copy Markdown

- What I did

Fixed docker service update --force so it preserves the existing service mount order when no mount options are supplied.

This prevents a subsequent identical docker stack deploy from detecting a mount-order difference and unnecessarily rolling the service again.

Fixes #7226

- How I did it

Changed updateService() to call updateMounts() only when --mount-add or --mount-rm was explicitly changed.

Added a regression test that performs a force-only update and verifies that:

  • ForceUpdate is incremented.
  • The existing mount order remains unchanged.

- How to verify it

Run:

go test -mod=vendor ./cli/command/service -run '^TestUpdateServiceForcePreservesMountOrder$' -count=1
go test -mod=vendor ./cli/command/service -run '^TestUpdate' -count=1

The regression test, all service update tests, and the complete service package passed locally in a disposable container environment.

- Human readable description for the release notes

Preserve service mount order during forced updates to avoid an unnecessary rollout on the next stack deploy.
OIP
Signed-off-by: Kamyar mofakhami <41609894+kawmy@users.noreply.github.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cli/command/service/update.go 0.00% 2 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

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