-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Install setup-envtest module version which matching with the controller-runtime version instead of latest #2480
Comments
/label triage/accepted |
@jmrodri: The label(s) In response to this:
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. |
@camilamacedo86 I would like to work on this. |
Adding here what was discussed in #2486 for : From @joelanford : This setup is going to result in the project's CI dependencies being added to the main project's go.mod file, which has implications on: From @camilamacedo86 : Note that the main reason/motivation for them do not add the dep as an import in the issue shared is Also this helps to make the version of our dependencies visible top-level (in the Makefile instead of hack/tools/go.mod) which does not seems our case; we are only trying to use this approach with the env-test to ensure that its version is compatible with the controller-runtime one scaffold in the project and not all scenarios. The approach was the solution provided by the controller-runtime maintainers, see: #2480 However, what would be your suggestion for us do not to scaffold to use env-test from the latest by default in this case?
That may be, but many users will see this tools pattern and start adding other build dependencies, thus further polluting their main go.mod file. One of the main goals of kubebuilder is to help reinforce best practices, and I'd consider it a bad practice to include build deps alongside library deps in the same go.mod/go.sum. One way to solve this problem is something like: CR_VERSION=$(shell go list -m sigs.k8s.io/controller-runtime | cut -d" " -f2)
ENVTEST = $(shell pwd)/bin/setup-envtest
.PHONY: envtest
envtest: ## Download envtest-setup locally if necessary.
$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@$(CR_VERSION)) From @camilamacedo86 : That does not work, see (we cannot use the tag to download the envtest, see: kubernetes-sigs/controller-runtime#1670 ) :
|
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
Is there a recommendation on how to get the dependencies?
EDIT: Don't love it but it works.. .PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
# https://github.com/kubernetes-sigs/kubebuilder/issues/2480
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/[email protected] |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close not-planned |
@k8s-triage-robot: Closing this issue, marking it as "Not Planned". In response to this:
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. |
The dependency on latest has just caused our build to suddenly fail without us changing anything:
This violates the principle of repeatable builds. We shouldn't be forced to upgrade to Go 1.19 before we are ready. There needs to be a better way. |
I also encountered this issue just now. You can temporarily fix it by using the command
|
Use go: downloading go.uber.org/multierr v1.10.0
# go.uber.org/multierr
/go/pkg/mod/go.uber.org/[email protected]/error.go:224:20: undefined: atomic.Bool
note: module requires Go 1.19 As @jroper mentioned above, it violates the principle of repeatable builds. |
As an alternative, not sure if it's better than referencing a specific commit, you can target a branch:
|
Using `@latest` for tools dependecies produces unrepeatable builds which might break at any point in time. This is particularly important when maintaining released versions which need a backport fix. Note: At the moment is not possible to reference the package `sigs.k8s.io/controller-runtime/tools/setup-envtest` with a specific version: ``` go: sigs.k8s.io/controller-runtime/tools/[email protected]: module sigs.k8s.io/[email protected] found, but does not contain package sigs.k8s.io/controller-runtime/tools/setup-envtest ``` See kubernetes-sigs/kubebuilder#2480 Ref: openshift/sriov-network-operator#849 Signed-off-by: Andrea Panattoni <[email protected]>
Using `@latest` for tools dependecies produces unrepeatable builds which might break at any point in time. This is particularly important when maintaining released versions which need a backport fix. Note: At the moment is not possible to reference the package `sigs.k8s.io/controller-runtime/tools/setup-envtest` with a specific version: ``` go: sigs.k8s.io/controller-runtime/tools/[email protected]: module sigs.k8s.io/[email protected] found, but does not contain package sigs.k8s.io/controller-runtime/tools/setup-envtest ``` See kubernetes-sigs/kubebuilder#2480 Ref: openshift#849 Signed-off-by: Andrea Panattoni <[email protected]>
Using `@latest` for tools dependecies produces unrepeatable builds which might break at any point in time. This is particularly important when maintaining released versions which need a backport fix. Note: At the moment is not possible to reference the package `sigs.k8s.io/controller-runtime/tools/setup-envtest` with a specific version: ``` go: sigs.k8s.io/controller-runtime/tools/[email protected]: module sigs.k8s.io/[email protected] found, but does not contain package sigs.k8s.io/controller-runtime/tools/setup-envtest ``` See kubernetes-sigs/kubebuilder#2480 Ref: openshift#849 Signed-off-by: Andrea Panattoni <[email protected]>
setup-envtest is installed in the automatically generated makefile target. Pinning its version to avoid updates to its repo like the minimum golang version in the go.mod can break compatibility and CI. See kubernetes-sigs/kubebuilder#2480
Using `@latest` for tools dependecies produces unrepeatable builds which might break at any point in time. This is particularly important when maintaining released versions which need a backport fix. Note: At the moment is not possible to reference the package `sigs.k8s.io/controller-runtime/tools/setup-envtest` with a specific version: ``` go: sigs.k8s.io/controller-runtime/tools/[email protected]: module sigs.k8s.io/[email protected] found, but does not contain package sigs.k8s.io/controller-runtime/tools/setup-envtest ``` See kubernetes-sigs/kubebuilder#2480 Ref: openshift#849 Signed-off-by: Andrea Panattoni <[email protected]>
What do you want to happen?
Motivation
The concern/motivation to raise this one is that in Kubebuilder, we are: (here)
Then, a KB user scaffolds the project today. The scaffold is done with controller-runtime version X.
Afterwards, we are still producing new releases and versions. Thus, this target can begin to download a version of this module that is no longer compatible.
Proposed solution
Then, the command
go install sigs.k8s.io/controller-runtime/tools/setup-envtest
ought to install its version whichcorresponding with the C+R version used into the project. More info: kubernetes-sigs/controller-runtime#1670
Extra Labels
No response
The text was updated successfully, but these errors were encountered: