close
Skip to content

sort secrets and configs to ensure idempotence - #509

Merged
vdemeester merged 1 commit into
docker:masterfrom
xificurC:fix-secrets-and-configs-idempotence
Sep 15, 2017
Merged

sort secrets and configs to ensure idempotence#509
vdemeester merged 1 commit into
docker:masterfrom
xificurC:fix-secrets-and-configs-idempotence

Conversation

@xificurC

@xificurC xificurC commented Sep 7, 2017

Copy link
Copy Markdown

docker stack deploy keeps restarting services it doesn't need to (no changes)
because the entries' order gets randomized at some previous (de)serialization.
Maybe it would be worth looking into this at a higher level and ensure
all (de)serialization happens in an ordered collection.

This quick fix sorts secrets and configs (in place, mutably) which ensures the
same order for each run.

Based on
moby/moby#30506

Fixes
moby/moby#34746

@codecov-io

codecov-io commented Sep 7, 2017

Copy link
Copy Markdown

Codecov Report

Merging #509 into master will decrease coverage by 0.02%.
The diff coverage is 0%.

@@            Coverage Diff             @@
##           master     #509      +/-   ##
==========================================
- Coverage   49.01%   48.99%   -0.03%     
==========================================
  Files         199      199              
  Lines       16392    16402      +10     
==========================================
+ Hits         8035     8036       +1     
- Misses       7939     7948       +9     
  Partials      418      418

@dnephin dnephin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. It looks like ParseSecrets() and ParseConfigs() do randomize the order of these unfortunately.

I think sorting is the correct solution, but I don't think the sort belongs in this function. Could you please move it to convertServiceSecrets() and convertServiceConfigObjs()

@xificurC
xificurC force-pushed the fix-secrets-and-configs-idempotence branch from b03cbbb to 34f8c0f Compare September 8, 2017 13:53
`docker stack deploy` keeps restarting services it doesn't need to (no changes)
because the entries' order gets randomized at some previous (de)serialization.
Maybe it would be worth looking into this at a higher level and ensure
all (de)serialization happens in an ordered collection.

This quick fix sorts secrets and configs (in place, mutably) which ensures the
same order for each run.

Based on
moby/moby#30506

Fixes
moby/moby#34746

Signed-off-by: Peter Nagy <xificurC@gmail.com>
@xificurC
xificurC force-pushed the fix-secrets-and-configs-idempotence branch from 34f8c0f to 27e8bdf Compare September 8, 2017 14:10
@xificurC

xificurC commented Sep 8, 2017

Copy link
Copy Markdown
Author

refactored as requested

@dnephin dnephin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vdemeester vdemeester left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐮

@mghazizadeh

Copy link
Copy Markdown

How's this tested?

@vieux

vieux commented Nov 15, 2017

Copy link
Copy Markdown
Contributor

@mghazizadeh the steps are given on the upstream PR: moby/moby#34746

vdemeester added a commit to vdemeester/docker-cli that referenced this pull request Nov 30, 2017
Related PR : docker#509

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
vdemeester added a commit to vdemeester/docker-cli that referenced this pull request Nov 30, 2017
Related PR : docker#509

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
vdemeester added a commit to vdemeester/docker-cli that referenced this pull request Nov 30, 2017
Related PR : docker#509

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
vdemeester added a commit to vdemeester/docker-cli that referenced this pull request Nov 30, 2017
Related PR : docker#509

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
vdemeester added a commit to vdemeester/docker-cli that referenced this pull request Nov 30, 2017
Related PR : docker#509

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
@vieux

vieux commented Nov 30, 2017

Copy link
Copy Markdown
Contributor

@mghazizadeh test was added in #719

andrewhsu pushed a commit to docker-archive/docker-ce that referenced this pull request Dec 1, 2017
Related PR : docker/cli#509

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 5ed399e58873944bf5e992284c751a200417318c
Component: cli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants