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

refactor: use govendor to depend on libnetwork #1445

Merged

Conversation

idealhack
Copy link
Contributor

@idealhack idealhack commented May 31, 2018

Ⅰ. Describe what this PR did

Use govendor to depend on alibaba/libnetwork.

Ⅱ. Does this pull request fix one issue?

this pull request should fixes #1344, but some issues with vendor.json raised there were not addressed yet, see #1344 (comment)

Ⅲ. Describe how you did it

As the commits show:

  1. refactor: remove extra logrus import and initNetworkLog function
  2. refactor: remove extra/libnetwork
  3. refactor: add alibaba/libnetwork as dependency with govendor
  4. refactor: fix api call for new version of libnetwork
  5. refactor: cleanup scripts related to extra/libnetwork
  6. refactor: govendor libnetwork without -tree (with great help of @rudyfly)
  7. refactor: update ablibaba/libnetwork

Ⅳ. Describe how to verify it

  1. make
  2. CI

Ⅴ. Special notes for reviews

I'm new to pouch, so please tell me if I missing anything.

@allencloud
Copy link
Collaborator

Thanks a lot for your work. This is quite important for pouch team how it will work with the latest libnetwork.

This branch is not squashed yet.

I think for the quite huge pull request, squashing is not necessary, and splitting the work into several commits would make it much easier to code review.

Currently the fix for contiv/executor is on my fork.

Could you explain more on the point above.

also involve @rudyfly for communication.

@idealhack
Copy link
Contributor Author

idealhack commented May 31, 2018

Currently the fix for contiv/executor is on my fork.

Could you explain more on the point above.

@allencloud Please take a look at contiv/executor and commit 4649d1d. We may send the patch to them or drop this package (to implement the feature we need by ourselves) later if you want.

Also, I think I could use some help with the (CI) tests, thanks.

@@ -537,18 +536,16 @@ func (nm *NetworkManager) getNetworkSandbox(id string) libnetwork.Sandbox {
return sb
}

// libnetwork's logrus version is different from pouchd,
// so we need to set libnetwork's logrus addintionly.
func initNetworkLog(cfg *config.Config) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If pouchd use the lastest libnetwork, initialize logrus is unuse.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, I thought about this but was not sure then.

@rudyfly
Copy link
Collaborator

rudyfly commented Jun 1, 2018

@idealhack Thanks a lot for your work. Change libnetwork into vendor is also my next job, my plan is fork the libnetwork into Alibaba group, because we need to change the libnetwork. Can you wait me to complete forking the libnetwork.

@idealhack
Copy link
Contributor Author

idealhack commented Jun 1, 2018

@rudyfly I see. It's reasonable to maintain a fork if you want change many things. So after you select a suitable version of libnetwork and forked it, I will make changes in this PR.

idealhack added a commit to idealhack/pouch that referenced this pull request Jun 1, 2018
@rudyfly
Copy link
Collaborator

rudyfly commented Jun 6, 2018

@idealhack I have fork libnetwork into github.com/alibaba/libnetwork, can you continue doing your next job?

@idealhack idealhack force-pushed the refactor/govendor-libnetwork branch from 627d187 to 67f98e3 Compare June 7, 2018 03:50
idealhack added a commit to idealhack/pouch that referenced this pull request Jun 7, 2018
address @rudyfly’s [comment](AliyunContainerService#1445 (comment))

Signed-off-by: Yang Li <idealhack@gmail.com>
@idealhack
Copy link
Contributor Author

@rudyfly I've rebased the branch. Could you check the tests?

@rudyfly
Copy link
Collaborator

rudyfly commented Jun 7, 2018

@idealhack Thanks for your job! You need to modify Makefile and hack/build.

@idealhack
Copy link
Contributor Author

@rudyfly Thanks, PTAL.

@@ -100,7 +100,7 @@ The following steps are also needed to make sure libnetwork package could be fou
```
BUILDPATH=/tmp/pouchbuild
mkdir -p $BUILDPATH/src/github.com/docker
cp -r /go/src/github.com/alibaba/pouch/extra/libnetwork $BUILDPATH/src/github.com/docker/libnetwork
cp -r /go/src/github.com/alibaba/pouch/vendor/github.com/docker/libnetwork $BUILDPATH/src/github.com/docker/libnetwork
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need to add libnetwork directory into GOPATH, it will vendor to build. I think just keep $BUILDPATH in GOPATH.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. I was not sure about this.

@@ -2,7 +2,7 @@
GOBUILD=go build
GOCLEAN=go clean
GOTEST=go test
GOPACKAGES=$(shell go list ./... | grep -v /vendor/ | grep -v /extra/ | sed 's/^_//')
GOPACKAGES=$(shell go list ./... | grep -v /vendor/ | sed 's/^_//')

# Binary name of CLI and Daemon
BINARY_NAME=pouchd
Copy link
Collaborator

@rudyfly rudyfly Jun 7, 2018

Choose a reason for hiding this comment

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

make pre in hack/build should be deleted libnetwork into GOPATH

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, but what do you suggest for this line in Makefile?

hack/build Outdated
@@ -26,7 +26,7 @@ function pre()

mkdir -p $BUILDPATH/src/github.com/docker
[ -L $BUILDPATH/src/github.com/docker/libnetwork ] && rm -f $BUILDPATH/src/github.com/docker/libnetwork
ln -s $DIR/extra/libnetwork $BUILDPATH/src/github.com/docker/libnetwork
ln -s $DIR/vendor/github.com/docker/libnetwork $BUILDPATH/src/github.com/docker/libnetwork
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rudyfly Is there any need for ln?

hack/make.sh Outdated
@@ -247,7 +247,7 @@ function target
rich container related tests will be skipped"

docker run --rm -v "$(pwd):$SOURCEDIR" \
-e GOPATH=/go:$SOURCEDIR/extra/libnetwork/Godeps/_workspace \
-e GOPATH=/go:$SOURCEDIR/vendor/github.com/docker/libnetwork/Godeps/_workspace \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rudyfly Also, please take a look at this line.

@rudyfly
Copy link
Collaborator

rudyfly commented Jun 7, 2018

@idealhack idealhack force-pushed the refactor/govendor-libnetwork branch from 8771c6d to 429f4e1 Compare June 7, 2018 09:03
@idealhack
Copy link
Contributor Author

@rudyfly I've checked your commit and made some modifications.

@rudyfly
Copy link
Collaborator

rudyfly commented Jun 7, 2018

@idealhack I think your modification is ok, but there are some ci fails, do you have ci environment to fix ci fails?

@idealhack
Copy link
Contributor Author

idealhack commented Jun 7, 2018

@rudyfly Yes this is what I'm confusing about.

Could anyone who contributing this project give some guidance on how to fix that?

@rudyfly
Copy link
Collaborator

rudyfly commented Jun 7, 2018

@idealhack OK, can you rebase master code, because I have changed network configure.

@rudyfly
Copy link
Collaborator

rudyfly commented Jun 8, 2018

@idealhack I have push my modification to your fork. 😃

@idealhack
Copy link
Contributor Author

@rudyfly Well done! Did you resolve those dependencies by hand?

@rudyfly
Copy link
Collaborator

rudyfly commented Jun 8, 2018

Well done! Did you resolve those dependencies by hand?

yes, it makes me crazy. 😭

And can you do rebase squash about these commits?

@idealhack
Copy link
Contributor Author

@rudyfly I was just about to said how can we do this in a less tedious way... If we have a script we can check it in here. Hope it will not make us more trouble in the future.

I see some commits are meanningless now. After the CI passed, I can do some squash work.

@idealhack idealhack force-pushed the refactor/govendor-libnetwork branch from 3af70b8 to 5eb0ea3 Compare June 8, 2018 04:35
@idealhack
Copy link
Contributor Author

@rudyfly I've squashed the commits, it's much cleaner now. Also, I backed up the old commits at refactor/govendor-libnetwork-backup just in case.

The CI still fails.

@fuweid
Copy link
Contributor

fuweid commented Jun 9, 2018

@idealhack could you provide the information about how to use govendor? I check the vendor/vendor.json and found that the github.com/Microsoft/go-winio is useless package. Thanks

@idealhack
Copy link
Contributor Author

@fuweid As I metioned in #1344 (comment) I found there are useless packages too.

That said, AFAIK go-winio is a dependency of libnetwork and containerd.

@rudyfly
Copy link
Collaborator

rudyfly commented Jun 12, 2018

@idealhack I'm sorry for delaying this work, I have modified libnetwork in alibaba, Can you update the latest commit on master again? Thank you very much.

@idealhack
Copy link
Contributor Author

idealhack commented Jun 12, 2018

@rudyfly Sure, here it is.

Since I want to leave the record of it, I added a new commit instead of amending.

@idealhack idealhack force-pushed the refactor/govendor-libnetwork branch 2 times, most recently from 02d67e9 to a8c1cf2 Compare June 12, 2018 07:15
@codecov-io
Copy link

codecov-io commented Jun 12, 2018

Codecov Report

Merging #1445 into master will decrease coverage by 0.11%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1445      +/-   ##
==========================================
- Coverage   40.56%   40.45%   -0.12%     
==========================================
  Files         254      254              
  Lines       16535    16527       -8     
==========================================
- Hits         6708     6686      -22     
- Misses       8965     8976      +11     
- Partials      862      865       +3
Impacted Files Coverage Δ
daemon/mgr/network.go 68.32% <0%> (-1.11%) ⬇️
daemon/containerio/container_io.go 58.33% <0%> (-3.21%) ⬇️
ctrd/watch.go 75% <0%> (-3.13%) ⬇️
daemon/logger/jsonfile/utils.go 70% <0%> (-1.67%) ⬇️
ctrd/container.go 49.45% <0%> (-0.73%) ⬇️
daemon/mgr/container.go 49.2% <0%> (-0.09%) ⬇️

idealhack and others added 7 commits June 12, 2018 16:01
Signed-off-by: Yang Li <idealhack@gmail.com>
Signed-off-by: Yang Li <idealhack@gmail.com>
The adding command is `govendor add github.com/docker/libnetwork/^::github.com/alibaba/libnetwork`

Signed-off-by: Yang Li <idealhack@gmail.com>
Signed-off-by: Yang Li <idealhack@gmail.com>
Signed-off-by: Yang Li <idealhack@gmail.com>
Signed-off-by: Rudy Zhang <rudyflyzhang@gmail.com>
1. `go get -u github.com/alibaba/libnetwork`
2. `govendor update github.com/docker/libnetwork/...::github.com/alibaba/libnetwork@04a77bdbfb6f51185791ee3d61e3644f058e6b21`

Signed-off-by: Yang Li <idealhack@gmail.com>
@idealhack idealhack force-pushed the refactor/govendor-libnetwork branch from a8c1cf2 to a9fa255 Compare June 12, 2018 08:02
@idealhack
Copy link
Contributor Author

CI tests passing after I rebased on master 🎉

We can now verify if this is what we need. Also, I've updated the description, PTAL.

@rudyfly
Copy link
Collaborator

rudyfly commented Jun 12, 2018

@idealhack Fantastic! 🍺🍺

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Jun 12, 2018
@allencloud
Copy link
Collaborator

Thanks for your work, and it is quite important for PouchContainer @idealhack
While I think this is quite huge, I would like to invite @rudyfly to take a thorough test of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
areas/network kind/refactor LGTM one maintainer or community participant agrees to merge the pull reuqest. size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[question] do we have a plan to revendor libnetwork to the latest version or stable one
6 participants