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

sort secrets and configs to ensure idempotence #509

Merged
merged 1 commit into from Sep 15, 2017

Conversation

Projects
None yet
8 participants
@xificurC

xificurC commented Sep 7, 2017

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

This comment has been minimized.

Show comment
Hide comment
@codecov-io

codecov-io Sep 7, 2017

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

codecov-io commented Sep 7, 2017

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

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()

pnagy
sort secrets and configs to ensure idempotence
`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

This comment has been minimized.

Show comment
Hide comment
@xificurC

xificurC Sep 8, 2017

refactored as requested

xificurC commented Sep 8, 2017

refactored as requested

@dnephin

dnephin approved these changes Sep 8, 2017

LGTM

@vdemeester

LGTM 🐮

@vdemeester vdemeester merged commit a09a2c6 into docker:master Sep 15, 2017

8 of 9 checks passed

codecov/patch 0% of diff hit (target 50%)
Details
ci/circleci: cross Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: shellcheck Your tests passed on CircleCI!
Details
ci/circleci: test Your tests passed on CircleCI!
Details
ci/circleci: validate Your tests passed on CircleCI!
Details
codecov/project 48.99% (-0.03%) compared to af94015
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
dco-signed All commits are signed

@GordonTheTurtle GordonTheTurtle added this to the 17.10.0 milestone Sep 15, 2017

@thaJeztah thaJeztah modified the milestones: 17.10.0, 17.09.0 Sep 19, 2017

@mghazizadeh

This comment has been minimized.

Show comment
Hide comment
@mghazizadeh

mghazizadeh Nov 13, 2017

How's this tested?

mghazizadeh commented Nov 13, 2017

How's this tested?

@vieux

This comment has been minimized.

Show comment
Hide comment
@vieux

vieux Nov 15, 2017

Contributor

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

Contributor

vieux commented Nov 15, 2017

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

vdemeester added a commit to vdemeester/cli that referenced this pull request Nov 30, 2017

Add unit tests on config/secret indempotence in stack deploy
Related PR : docker#509

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

vdemeester added a commit to vdemeester/cli that referenced this pull request Nov 30, 2017

Add unit tests on config/secret indempotence in stack deploy
Related PR : docker#509

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

vdemeester added a commit to vdemeester/cli that referenced this pull request Nov 30, 2017

Add unit tests on config/secret indempotence in stack deploy
Related PR : docker#509

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

vdemeester added a commit to vdemeester/cli that referenced this pull request Nov 30, 2017

Add unit tests on config/secret indempotence in stack deploy
Related PR : docker#509

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

vdemeester added a commit to vdemeester/cli that referenced this pull request Nov 30, 2017

Add unit tests on config/secret indempotence in stack deploy
Related PR : docker#509

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

This comment has been minimized.

Show comment
Hide comment
@vieux

vieux Nov 30, 2017

Contributor

@mghazizadeh test was added in #719

Contributor

vieux commented Nov 30, 2017

@mghazizadeh test was added in #719

andrewhsu pushed a commit to docker/docker-ce that referenced this pull request Dec 1, 2017

Add unit tests on config/secret indempotence in stack deploy
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