Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ helm: manifests kubebuilder
## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
mkdir -p "$(LOCALBIN)"

CURL_RETRIES=3

Expand Down Expand Up @@ -289,7 +289,7 @@ $(KUSTOMIZE): $(LOCALBIN)
.PHONY: kubectl
kubectl: $(KUBECTL) ## Download kubectl locally if necessary.
$(KUBECTL): $(LOCALBIN)
curl --retry $(CURL_RETRIES) -fsL https://dl.k8s.io/release/v$(ENVTEST_K8S_VERSION)/bin/$(GOOS)/$(GOARCH)/kubectl -o $(KUBECTL)
curl --retry $(CURL_RETRIES) -fsL https://dl.k8s.io/release/v$(ENVTEST_K8S_VERSION)/bin/$(GOOS)/$(GOARCH)/kubectl -o "$(KUBECTL)"
ln -sf "$(KUBECTL)" "$(KUBECTL_BIN)"
chmod +x "$(KUBECTL_BIN)" "$(KUBECTL)"

Expand All @@ -302,7 +302,7 @@ $(CONTROLLER_GEN): $(LOCALBIN)
.PHONY: setup-envtest
setup-envtest: envtest ## Download the binaries required for ENVTEST in the local bin directory.
@echo "Setting up envtest binaries for Kubernetes version $(ENVTEST_K8S_VERSION)..."
@$(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path || { \
@"$(ENVTEST)" use $(ENVTEST_K8S_VERSION) --bin-dir "$(LOCALBIN)" -p path || { \
echo "Error: Failed to set up envtest binaries for version $(ENVTEST_K8S_VERSION)."; \
exit 1; \
}
Expand Down Expand Up @@ -333,6 +333,7 @@ $(KUBEBUILDER): $(LOCALBIN)
$(call go-install-tool,$(KUBEBUILDER),sigs.k8s.io/kubebuilder/v4,$(KUBEBUILDER_VERSION))

# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# Note: All paths are quoted to work in directories containing spaces or parentheses.
# $1 - target path with name of binary
# $2 - package url which can be installed
# $3 - specific version of package
Expand All @@ -341,11 +342,11 @@ define go-install-tool
set -e; \
package=$(2)@$(3) ;\
echo "Downloading $${package}" ;\
rm -f $(1) || true ;\
GOBIN=$(LOCALBIN) go install $${package} ;\
mv $(1) $(1)-$(3) ;\
rm -f "$(1)" || true ;\
GOBIN="$(LOCALBIN)" go install "$${package}" ;\
mv "$(1)" "$(1)-$(3)" ;\
} ;\
ln -sf $(1)-$(3) $(1)
ln -sf "$(1)-$(3)" "$(1)"
endef

## --------------------------------------
Expand Down
Loading