Skip to content
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

Make docker stack deploy a little bit more indempotent #30506

Merged
merged 1 commit into from
Jan 31, 2017

Conversation

vdemeester
Copy link
Member

Version of #29732 for master.


Make sure running multiple times docker stack deploy --compose-file docker-compose.yml foo on the same unchanged file doesn't update the services each times. This is mainly due to the use of map .

This is related to #29676

This is sorting environment, extraHost and port too. There is some weirdiness with ports but a PR might follow for that. You can reproduce and validate this using the following compose file.

version: "3.0"

services:
  test:
    image: busybox
    command: top
    extra_hosts:
      - foo:1.1.1.1
      - bar:2.2.2.2
    environment:
      - FOO=BAR
      - FAR=BOO
    ports:
      - "5000:80"
      - "5001:81"
    networks: [front-tier, back-tier]

networks:
  front-tier:
  back-tier:

This also helps with Error response from daemon: rpc error: code = 2 desc = changing network in service is not supported when you didn't change the networks.

/cc @thaJeztah @dnephin @icecrime @cpuguy83 @aaronlehmann @aanand

If it gets in, I'll do a PR against master.

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

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

Sort some slice fields before sending them to the swarm api so that it
won't trigger an update.

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

@LK4D4 LK4D4 left a comment

Choose a reason for hiding this comment

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

LGTM

@LK4D4
Copy link
Contributor

LK4D4 commented Jan 31, 2017

ping @docker/core-engine-maintainers

@estesp
Copy link
Contributor

estesp commented Jan 31, 2017

LGTM

@estesp estesp merged commit feb8b1c into moby:master Jan 31, 2017
@GordonTheTurtle GordonTheTurtle added this to the 1.14.0 milestone Jan 31, 2017
@thaJeztah thaJeztah modified the milestones: 1.13.1, 1.14.0 Jan 31, 2017
@vdemeester vdemeester deleted the 29732-follow-up-compose-indempotent branch January 31, 2017 21:52
@adventureisyou
Copy link

I'm seeing the same problem caused by secrets not being sorted. From nosing at the code, I don't think that was fixed in here, though it looks like secrets are handled slightly differently, so please let me know if I'm wrong. I'll happily open a separate ticket for secrets if that's the best way forward.

@thaJeztah
Copy link
Member

@DrSolaris thanks for reporting; can you open a new issue for that for tracking? (you can include a link to this issue in the description)

dnephin pushed a commit to dnephin/docker that referenced this pull request Apr 17, 2017
…-indempotent

Make docker stack deploy a little bit more indempotent
xificurC pushed a commit to xificurC/cli that referenced this pull request 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
xificurC pushed a commit to xificurC/cli that referenced this pull request 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

Signed-off-by: Peter Nagy <xificurC@gmail.com>
xificurC pushed a commit to xificurC/cli that referenced this pull request Sep 8, 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

Signed-off-by: Peter Nagy <xificurC@gmail.com>
xificurC pushed a commit to xificurC/cli that referenced this pull request Sep 8, 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

Signed-off-by: Peter Nagy <xificurC@gmail.com>
riyazdf pushed a commit to riyazdf/cli that referenced this pull request Sep 18, 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

Signed-off-by: Peter Nagy <xificurC@gmail.com>
riyazdf pushed a commit to riyazdf/cli that referenced this pull request Sep 18, 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

Signed-off-by: Peter Nagy <xificurC@gmail.com>
riyazdf pushed a commit to riyazdf/cli that referenced this pull request Sep 18, 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

Signed-off-by: Peter Nagy <xificurC@gmail.com>
thaJeztah pushed a commit to thaJeztah/docker-ce that referenced this pull request Sep 19, 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

Signed-off-by: Peter Nagy <xificurC@gmail.com>
(cherry picked from commit 27e8bdf32bbcc49ff3f8201b6da26aba567aa58e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah pushed a commit to thaJeztah/docker-ce that referenced this pull request Sep 19, 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

Signed-off-by: Peter Nagy <xificurC@gmail.com>
(cherry picked from commit 27e8bdf32bbcc49ff3f8201b6da26aba567aa58e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
andrewhsu pushed a commit to docker-archive/docker-ce that referenced this pull request Sep 19, 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

Signed-off-by: Peter Nagy <xificurC@gmail.com>
Upstream-commit: 27e8bdf32bbcc49ff3f8201b6da26aba567aa58e
Component: cli
silvin-lubecki pushed a commit to silvin-lubecki/docker-ce that referenced this pull request Jan 29, 2020
`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>
(cherry picked from commit 27e8bdf32bbcc49ff3f8201b6da26aba567aa58e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
silvin-lubecki pushed a commit to silvin-lubecki/cli-extract that referenced this pull request Jan 29, 2020
`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>
(cherry picked from commit 27e8bdf)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
silvin-lubecki pushed a commit to silvin-lubecki/cli-extract that referenced this pull request Mar 17, 2020
`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>
(cherry picked from commit 27e8bdf)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
silvin-lubecki pushed a commit to silvin-lubecki/cli-extract that referenced this pull request Mar 23, 2020
`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>
(cherry picked from commit 27e8bdf)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
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.

6 participants