-
Notifications
You must be signed in to change notification settings - Fork 2k
Fix stack deploy re-deploying service after --force #963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix stack deploy re-deploying service after --force #963
Conversation
When updating a service with the `--force` option, the `ForceUpdate` property of the taskspec is incremented. Stack deploy did not take this into account, and reset this field to its default value (0), causing the service to be re-deployed. This patch copies the existing value before updating the service. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🐯
| // Stack deploy does not have a `--force` option. Preserve existing ForceUpdate | ||
| // value so that tasks are not re-deployed if not updated. | ||
| // TODO move this to API client? | ||
| serviceSpec.TaskTemplate.ForceUpdate = service.Spec.TaskTemplate.ForceUpdate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was also comparing serviceSpec with service.Spec here, and noticed there's quite some other properties that differ; not sure if those are expected;
{"Name":"test_redis","Labels":{"com.docker.stack.image":"redis:3.2.8","com.docker.stack.namespace":"test"},"TaskTemplate":{"ContainerSpec":{"Image":"redis:3.2.8@sha256:8eb0cd22644dc1218680db876411f45baac493ac9a0bfd391d6efdef0767ea6b","Labels":{"com.docker.stack.namespace":"test"},"Privileges":{"CredentialSpec":null,"SELinuxContext":null},"Isolation":"default"},"Resources":{},"Placement":{"Platforms":[{"Architecture":"amd64","OS":"linux"}]},"Networks":[{"Target":"x5ce5v6s4fzjdd6eavt9njahb","Aliases":["redis"]}],"ForceUpdate":1,"Runtime":"container"},"Mode":{"Replicated":{"Replicas":1}},"EndpointSpec":{"Mode":"vip"}}
{"Name":"test_redis","Labels":{"com.docker.stack.image":"redis:3.2.8","com.docker.stack.namespace":"test"},"TaskTemplate":{"ContainerSpec":{"Image":"redis:3.2.8 ","Labels":{"com.docker.stack.namespace":"test"},"Privileges":{"CredentialSpec":null,"SELinuxContext":null} },"Resources":{},"Placement":{ },"Networks":[{"Target":"test_default" ,"Aliases":["redis"]}],"ForceUpdate":1 },"Mode":{"Replicated":{ }},"EndpointSpec":{ }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
LGTM |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

When updating a service with the
--forceoption, theForceUpdateproperty of the taskspec is incremented.Stack deploy did not take this into account, and reset this field to its default value (0), causing the service to be re-deployed.
This patch copies the existing value before updating the service.
fixes moby/moby#36028
- Description for the changelog