k8snetworkplumbingwg / ovs-cni

Open vSwitch CNI plugin
Apache License 2.0
222 stars 70 forks source link

Failure while running 'make' command #215

Closed mardim91 closed 2 years ago

mardim91 commented 2 years ago

Hello,

A failure have occured while I was running 'make' command in the main branch. Also same failures happen in tagged versions. (e.g v0.24.0)

Rerproduce:

  1. clone the ovs-cni repo
  2. run 'make'

Error:

hack/install-go.sh /root/apps/ovs-cni/build/_output/bin/ + destination=/root/apps/ovs-cni/build/_output/bin/ + version=1.16.8 + tarball=go1.16.8.linux-amd64.tar.gz + url=https://dl.google.com/go/ + mkdir -p /root/apps/ovs-cni/build/_output/bin/ + curl -L https://dl.google.com/go//go1.16.8.linux-amd64.tar.gz -o /root/apps/ovs-cni/build/_output/bin//go1.16.8.linux-amd64.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 66 100 66 0 0 478 0 --:--:-- --:--:-- --:--:-- 474 100 123M 100 123M 0 0 33.6M 0 0:00:03 0:00:03 --:--:-- 38.8M + tar -xf /root/apps/ovs-cni/build/_output/bin//go1.16.8.linux-amd64.tar.gz -C /root/apps/ovs-cni/build/_output/bin/ setting GOPATH... building golint... go get: upgraded golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f => v0.0.0-20210508222113-6edffad5e616 go get: upgraded golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d => v0.0.0-20211015210444-4f30a5c0130f go get: upgraded golang.org/x/tools v0.0.0-20210106214847-113979e3529a => v0.1.8 # golint installation modifies go.mod and it causes golint failure so run mod tidy here /root/apps/ovs-cni/build/_output/bin//go//bin//go mod tidy running golint... go: inconsistent vendoring in /root/apps/ovs-cni/.gopath/src/github.com/k8snetworkplumbingwg/ovs-cni: golang.org/x/net@v0.0.0-20211015210444-4f30a5c0130f: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt golang.org/x/sys@v0.0.0-20211019181941-9d821ace8654: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt golang.org/x/text@v0.3.7: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt golang.org/x/net@v0.0.0-20210805182204-aaa1db679c0d: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod

To ignore the vendor directory, use -mod=readonly or -mod=mod. To sync the vendor directory, run: go mod vendor /root/apps/ovs-cni/build/_output/bin//go//bin//go fmt ./pkg/... ./cmd/... go: inconsistent vendoring in /root/apps/ovs-cni: golang.org/x/net@v0.0.0-20211015210444-4f30a5c0130f: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt golang.org/x/sys@v0.0.0-20211019181941-9d821ace8654: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt golang.org/x/text@v0.3.7: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt golang.org/x/net@v0.0.0-20210805182204-aaa1db679c0d: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod

To ignore the vendor directory, use -mod=readonly or -mod=mod. To sync the vendor directory, run: go mod vendor Makefile:53: recipe for target 'format' failed make: *** [format] Error 1

phoracek commented 2 years ago

Thanks for reporting this.

So far I failed to reproduce it locally, but I see it failing on our CI too: https://storage.googleapis.com/kubevirt-prow/pr-logs/pull/k8snetworkplumbingwg_ovs-cni/216/pull-e2e-ovs-cni/1470329777473720320/build-log.txt

mardim91 commented 2 years ago

The way that I caught the error is by freshly cloning ovs cni repo and then running make. So maybe if you try to clean up your environment, clone ovs cni and run make you would be probably able to see the error also locally. Of course if you already tried that then I am not sure why you can not see it locally.

mardim91 commented 2 years ago

Is there any update on this issue ? is it fixed ?

phoracek commented 2 years ago

Indeed, it was reproduced on a fresh machine. I proposed a fix here: https://github.com/k8snetworkplumbingwg/ovs-cni/pull/217

phoracek commented 2 years ago

@mardim91 could you check out the current main and confirm that it was fixed for you?

mardim91 commented 2 years ago

@phoracek I have tested your change in the main branch and is working. The problem is that in our installation process of ovs-cni we consume the stable tagged version v0.24.0 and there the problem is not resolved. Can you replicate your change to the tagged versions also so we do not get the issue in the v0.24.0 branch ?

phoracek commented 2 years ago

That would require creating stable branches for v0.26, v0.25 and v0.24, resolving it with separate patches on all 3, and finally publishing a new patch release for all.

Could you upgrade to a later release or include go mod vendor in your pipeline?

mardim91 commented 2 years ago

I would not like to update to a later realease. I would prefer to run the go mod vendor cmd.

Can you please explain how to run that command to solve the issue of installing ovs-cni ?

  1. run go mod vendor
  2. run make

do those commands above in that order solve the issue ?

phoracek commented 2 years ago

Correct, calling go mod vendor again fixed the source tree in https://github.com/k8snetworkplumbingwg/ovs-cni/pull/217.

mardim91 commented 2 years ago

Unfortunately that's not a workable solution. The probelm is that golang is installed after we run make. So the procedure is like this:

  1. clone ovs-cni repo
  2. run make : "fails with the error that is reported in this issue"
  3. run ovs-cni/build/_output/bin/go/bin/go mod vendor
  4. rerun make : "make succeeds"

So this way yes the installaton suceeds but we still have an initial failure (step 2) which we cannot avoid in an automated installation environment.

Do you have something else to suggest ?

phoracek commented 2 years ago

Install golang and call go mod vendor first?

mardim91 commented 2 years ago

We have just used the Tip of the main branch to solve the issue. I think we can close this issue.

phoracek commented 2 years ago

Thansk @mardim91 o/