-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[17.06] backport Skip inspect of built-in networks on stack deploy #146
Conversation
This fix use `scope=swarm` for service related network inspect. The purpose is that, in case multiple networks with the same name exist in different scopes, it is still possible to obtain the network for services. This fix is related to moby/moby#33630 and docker/cli#167 Signed-off-by: Yong Tang <yong.tang.github@outlook.com> (cherry picked from commit 657457ee2cc1b4ced804674ad1b3bfe19b849f31) Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
Signed-off-by: Alex Mavrogiannis <alex.mavrogiannis@docker.com> (cherry picked from commit 7f53c99dfe5241a985dd5ce4bed6c116a2908b41) Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
Hmm...just noticed the one git commit i pulled in from docker/cli#184 may require the vendor of docker/docker to get the moby/moby/pull/33630 change. |
It looks like the Instead of a clean cherry-pick of docker/cli#362, we could consider a backport PR that omits lines 185 and 186 entirely: https://github.com/docker/cli/pull/362/files#diff-f45e59dc9b7f6a7c5aafbeab6a677260R185 PTAL codeowners @dnephin and @vdemeester for a confirmation on whether that's a good approach Disclaimer: This is the first time I'm navigating the new cross-linked repository model. |
@dnephin @vdemeester @alexmavr Hmm...the lines 185 and 186 are outside of the conflict area. Here is how I created the cherry pick and arrived at the conflict with just docker/cli@7f53c99: $ git clone git@github.com:docker/docker-ce # fresh clone
$ cd docker-ce # enter the working dir
$ git checkout 17.06 # checkout the branch
$ git fetch git@github.com:docker/cli master:cli # get the git commits from upstream cli
$ git cherry-pick -s -x -Xsubtree=components/cli 7f53c99 # pick just the one commit
$ git diff --diff-filter=U # show the conflicting lines
diff --cc components/cli/cli/command/stack/deploy_composefile.go
index 1cafca58e7,1f50ae1a1d..0000000000
--- a/components/cli/cli/command/stack/deploy_composefile.go
+++ b/components/cli/cli/command/stack/deploy_composefile.go
@@@ -174,7 -171,12 +174,16 @@@ func validateExternalNetworks
externalNetworks []string,
) error {
for _, networkName := range externalNetworks {
++<<<<<<< HEAD
+ network, err := client.NetworkInspect(ctx, networkName, false)
++=======
+ if !container.NetworkMode(networkName).IsUserDefined() {
+ // Networks that are not user defined always exist on all nodes as
+ // local-scoped networks, so there's no need to inspect them.
+ continue
+ }
+ network, err := client.NetworkInspect(ctx, networkName, types.NetworkInspectOptions{})
++>>>>>>> 7f53c99dfe... Skip inspects of built-in networks on stack deploy
switch {
case dockerclient.IsErrNotFound(err):
return errors.Errorf("network %q is declared as external, but could not be found. You need to create a swarm-scoped network before the stack is deployed", networkName)
diff --cc components/cli/cli/command/stack/deploy_composefile_test.go
index 6d811ed208,f303fc8865..0000000000
--- a/components/cli/cli/command/stack/deploy_composefile_test.go
+++ b/components/cli/cli/command/stack/deploy_composefile_test.go
@@@ -70,7 -73,8 +73,12 @@@ func TestValidateExternalNetworks(t *te
for _, testcase := range testcases {
fakeClient := &network.FakeClient{
++<<<<<<< HEAD
+ NetworkInspectFunc: func(_ context.Context, _ string, _ bool) (types.NetworkResource, error) {
++=======
+ NetworkInspectFunc: func(_ context.Context, _ string, _ types.NetworkInspectOptions) (types.NetworkResource, error) {
+ testcase.inspected = true
++>>>>>>> 7f53c99dfe... Skip inspects of built-in networks on stack deploy
return testcase.inspectResponse, testcase.inspectError
},
} |
Ah, I'm sure lines 185 and 186 would cause a build failure then. To resolve the conflict, I believe the best approach is to just switch the invocations of the Since this is definitely not a clean cherry-pick, how can I file a backport PR? Is there any such precedent yet? |
@alexmavr You can create a separate PR to the docker-ce 17.06 branch with the cherry pick if you follow the same procedure I documented to arrive at the conflict: #146 (comment) And I can have a look and close this PR if it is suitable. |
@andrewhsu filed #161 with a manual conflict resolution. PTAL and close this one if needed |
Make IMAGE_TAG configurable for dockerd.json Upstream-commit: e344a52 Component: packaging
Make IMAGE_TAG configurable for dockerd.json
To backport fix:
Attempted to cherry-pick the only commit of that PR, docker/cli@7f53c99, and had a conflict. Chose to resolve it by bringing in one more older commit docker/cli@657457e from PR docker/cli/pull/184
Cherry pick command for docker/cli@657457e (to prevent conflict) and docker/cli@7f53c99 (to bring in originally intended fix):
This then resulted in no conflicts.
cc @alexmavr @mavenugo @dnephin @thaJeztah may want to double check if the extra commit is ok to bring in to avoid the cherry-pick conflict