File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ uninstall-cert:
189
189
controller-gen : $(CONTROLLER_GEN )
190
190
$(CONTROLLER_GEN ) : $(LOCALBIN )
191
191
test -s $(LOCALBIN ) /controller-gen && $(LOCALBIN ) /controller-gen --version | grep -q $(CONTROLLER_TOOLS_VERSION ) || \
192
- GOBIN = $( LOCALBIN ) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION )
192
+ $(call go-get-tool, sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION) )
193
193
194
194
# #@ Deployment
195
195
@@ -219,7 +219,19 @@ $(KUSTOMIZE): $(LOCALBIN)
219
219
.PHONY : envtest
220
220
envtest : $(ENVTEST ) # # Download envtest-setup locally if necessary.
221
221
$(ENVTEST ) : $(LOCALBIN )
222
- test -s $(LOCALBIN ) /setup-envtest || GOBIN=$(LOCALBIN ) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
222
+ test -s $(LOCALBIN ) /setup-envtest || $(call go-get-tool,sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)
223
+
224
+ # go-get-tool will 'go install' any package $2 and install it to $1.
225
+ PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST ) ) ) )
226
+ define go-get-tool
227
+ set -e ;\
228
+ TMP_DIR=$$(mktemp -d ) ;\
229
+ cd $$TMP_DIR ;\
230
+ go mod init tmp ;\
231
+ echo "Downloading $(1 ) " ;\
232
+ GOBIN=$(LOCALBIN ) go install $(1 ) ;\
233
+ rm -rf $$TMP_DIR ;
234
+ endef
223
235
224
236
# Generate bundle manifests and metadata, then validate generated files.
225
237
.PHONY : bundle
You can’t perform that action at this time.
0 commit comments