-
Notifications
You must be signed in to change notification settings - Fork 187
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
Enable vendoring. #558
Enable vendoring. #558
Conversation
talking about this at the office hours today, a question has arisen about why we might want to add vendoring. one reason, is to help be more explicit about the supply chain and dependencies. also to help reduce errors that might happen from our dependencies changing between when we build and when an upstream dependency might update. to simplify the vendor flags, if we want, we could also from the docs https://go.dev/ref/mod
|
/assign @ipochi |
/retest |
1771674
to
6b058c2
Compare
Based on discussion I changed things so that:
Happy to tweak further, otherwise I think this is ready. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing the PR, the default behaviour from go 1.11 and you're vendoring is that it has by default this -mod=vendor
added. But if that so I would say to remove it in all the cases or add it in all the cases (I'm in the side of add it in all the cases.)
Not just for build but also for go test
commands in the makefile.
I think this is not in the scope of this pr but I also would add something like:
GO=GO111MODULE=on GOFLAGS=-mod=vendor go
GO_BUILD_RECIPE=CGO_ENABLED=1 $(GO) build .....
And this $(GO_BUILD_RECIPE)
add them in all the cases to be consistent. Maybe I can drop a following up PR fixing some things like this one.
I would like to have other community opinions like from @cheftako or @ipochi to have more points of view.
This was a good suggestion, because it caught the absence of vendor/ in the konnectivity-client module. Latest upload vendors both modules, and runs tests with the flag.
+1 to keeping deeper cleanup separate from this PR. We should improve consistency between Makefile and Dockerfiles as well (example: GO111MODULE=on). |
I think adding vendor consistently for the rest of the ANP seems like a good idea. It not only makes the build chain clear but it means when doing code inspection/debugging you have the correct version of the code present cutting down on confusion due to dependency version discrepancies. Konnectivity-client is a bit different. It is not an executable but a library. The version of its dependencies are determined by the build of the executables which pull it in. So I worry that at best pulling a vendor directory into konnectivity-client is misleading. At worst it might cause problems for things like merging it into the K/K KAS build. |
Good thinking, I checked and it seems that there should not be k/k problems. I tried updating k/k with:
as hoped, the https://go.dev/ref/mod#vendoring says That said, it does seem heavy handed to vendor the pure client lib, just in support of a single test |
Choices:
I still lean toward 1, because it makes the repo consistent (all builds and tests run against locally available dependencies) but I can switch to 2 if @cheftako feels strongly, or if others also prefer it. |
Well, @cheftako knows better than me the project, so I think He will have the point here :). |
Thanks. I'll switch to option 2 since there is better consensus there. |
/assign @cheftako |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cheftako, jkh52 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Enable vendoring.
Motivation: isolation, reliability, and reproducibility.
Note to reviewer: the first commit is large, but all manual edits are in the second commit.