Skip to content

Commit 6a63299

Browse files
committed
Makefile: Fix syntax error in kustomize.
1 parent 400eb61 commit 6a63299

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Makefile

+7-2
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,17 @@ KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/k
187187
.PHONY: kustomize
188188
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
189189
$(KUSTOMIZE): $(LOCALBIN)
190-
test -s $(LOCALBIN)/kustomize || { curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN) }
190+
@if test -x $(LOCALBIN)/kustomize && ! $(LOCALBIN)/kustomize version | grep -q $(KUSTOMIZE_VERSION); then \
191+
echo "$(LOCALBIN)/kustomize version is not expected $(KUSTOMIZE_VERSION). Removing it before installing."; \
192+
rm -rf $(LOCALBIN)/kustomize; \
193+
fi
194+
test -s $(LOCALBIN)/kustomize || { curl -Ss $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); }
191195

192196
.PHONY: controller-gen
193197
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
194198
$(CONTROLLER_GEN): $(LOCALBIN)
195-
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
199+
test -s $(LOCALBIN)/controller-gen && $(LOCALBIN)/controller-gen --version | grep -q $(CONTROLLER_TOOLS_VERSION) || \
200+
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
196201

197202
.PHONY: envtest
198203
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.

0 commit comments

Comments
 (0)