Add setup-envtest to tools.go for vendoring#516
Conversation
f0fe896 to
ab24401
Compare
Add `tools/tools.go` with a blank import of `setup-envtest` so the tool is pulled into the vendor directory. Uses the `release-0.22` branch pseudo-version which requires Go 1.24 (compatible with the project's Go 1.25). Replace `go install` invocation of `setup-envtest` in the Makefile with `go run`, removing the `envtest` target and `ENVTEST` variable. Co-Authored-By: Claude Signed-off-by: Andrey Lebedev <alebedev@redhat.com>
ab24401 to
d6740b0
Compare
|
Two observations from comparing against #518. 1. Makefile KUBEBUILDER_ASSETS="$(shell go run sigs.k8s.io/controller-runtime/tools/setup-envtest use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out
2. Commit message for It ignores untracked files -- which is exactly the failure mode here (newly materialised vendor dirs that were never |
Run `go mod tidy` and `go mod vendor`, then assert with `git status --porcelain` that no tracked modifications and no untracked entries remain. `git diff --exit-code` alone is insufficient because it ignores untracked files. Co-Authored-By: Claude Signed-off-by: Andrey Lebedev <alebedev@redhat.com>
66171ce to
d00624f
Compare
|
Force pushed to retest the bundle deployment on KIND. |
The previous recipe used `KUBEBUILDER_ASSETS="$(shell go run sigs.k8s.io/...setup-envtest ...)"` to compute the assets path. GNU Make's `$(shell ...)` captures stdout only and silently discards the exit code, so when `go run` failed (for example with `cannot find module providing package ... import lookup disabled by -mod=vendor`) the variable expanded to the empty string and tests proceeded with `KUBEBUILDER_ASSETS=""`. Tests that do not currently consume the assets path then passed regardless, masking the real failure. Move the substitution into the recipe shell. After `go run`, assert that `KUBEBUILDER_ASSETS` is non-empty and exit with a clear message otherwise. Echo the resolved invocation before running it so the build log records the exact `go test` command, mirroring the readability of the previous one-liner. Signed-off-by: Andrew McDermott <amcdermo@redhat.com>
Add
tools/tools.gowith a blank import ofsetup-envtestso the tool is included in the vendor directory. Uses therelease-0.22branch pseudo-version (v0.0.0-20260125163108-a19ec76a3c5d) which requires Go 1.24 (compatible with the project's Go 1.25). The only tagged semver release (v0.24.0) requires Go 1.26 and is not usable yet.Replace the
go install/binary invocation ofsetup-envtestin the Makefile withgo run, removing theenvtesttarget andENVTESTvariable. Since the tool is now vendored,go runpicks it up directly without needing a separate install step.Also includes the vendor drift CI check from #517: run
go mod tidy && go mod vendorand assert withgit status --porcelainthat no tracked modifications or untracked entries remain undervendor/,go.modorgo.sum.