-
Notifications
You must be signed in to change notification settings - Fork 267
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
Fixes bazel build system for those using bazelisk #3158
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @bc185174. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Signed-off-by: bcoxford <[email protected]>
/ok-to-test |
/test all |
@bc185174 can you explain how your comments on reproducibility and cgo are relevant here? |
Yeah sure. They're not really relevant to this PRs fix but just a general observation when I was trying to run tests/build binaries locally. I didn't realise you had build containers to test in! I think the build container is great for workflows, but devs shouldn't need this to run and build things locally.
Must admit I'm not up to scratch with why you use cgo as there are good reasons to! But there are pretty decent go libraries out there now trying to replace the need for calling C libraries and removing that dependency. See you use cgo for libguestfs.org/libnbd - https://github.com/pojntfx/go-nbd for example. Side-note: k8s sig recommends against their fake client now with preference of using envtest as you are using a real client and a real API server. |
Would you mind linking the source? sounds really interesting |
Sure https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/client/fake#pkg-overview. Kube-builder have quite a useful reference as well https://book.kubebuilder.io/reference/envtest.html. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with /lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with /lifecycle stale |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with /lifecycle rotten |
What this PR does / why we need it:
.bazelversion
to ensure we have a good version of bazel chosen when building the repo. Users with bazel > 5.4.1 will hit build errors or those on 7.x.x will attempt to enable bazel modules..user.bazelrc
and.ci.bazelrc
options for users to configured..gitignore
so they are not checked into git.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
N/A
Special notes for your reviewer:
Bazel is built with reproducibility in mind. Library, test, and binary builds are incremental, so there is not really any need to rely on external build containers since the binaries should always produce the same result.
I know its not always possible but should try to avoid
cgo
. These types of builds are complicated and often you'll hit build issues and break cross compiling. Not to mention its slower. Couple good article reads below on these topics but generally if you can avoid it, don't use it or at a last resort isolate thecgo
dependencies.https://dave.cheney.net/2016/01/18/cgo-is-not-go
https://relistan.com/cgo-when-and-when-not-to-use-it
Release note: