Skip to content

Commit

Permalink
Add clusterctl to local set of tools
Browse files Browse the repository at this point in the history
  • Loading branch information
dlipovetsky committed Dec 26, 2023
1 parent 847d34a commit f1252c7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ GOLANGCI_LINT_VER := v1.55.2
GOLANGCI_LINT_BIN := golangci-lint
GOLANGCI_LINT := $(abspath $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN))

# Install clusterctl that corresponds to the cluster-api go mod version
CLUSTERCTL_VER := $(shell go list -m sigs.k8s.io/cluster-api | cut -d" " -f2)
CLUSTERCTL_RELEASE_URL := https://github.com/kubernetes-sigs/cluster-api/releases/download/$(CLUSTERCTL_VER)/clusterctl-$(shell go env GOOS)-$(shell go env GOARCH)
CLUSTERCTL_BIN := clusterctl
CLUSTERCTL := $(abspath $(TOOLS_BIN_DIR)/$(CLUSTERCTL_BIN))

# CRD_OPTIONS define options to add to the CONTROLLER_GEN
CRD_OPTIONS ?= "crd:crdVersions=v1"

Expand Down Expand Up @@ -529,6 +535,9 @@ $(TILT_PREPARE_BIN): $(TILT_PREPARE) ## Build a local copy of tilt-prepare.
.PHONY: $(GOLANGCI_LINT_BIN)
$(GOLANGCI_LINT_BIN): $(GOLANGCI_LINT) ## Build a local copy of golangci-lint

.PHONY: $(CLUSTERCTL_BIN)
$(CLUSTERCTL_BIN): $(CLUSTERCTL) ## Build a local copy of clusterctl

$(GINKGO): # Build ginkgo from tools folder.
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(GINKGO_PKG) $(GINKGO_BIN) $(GINGKO_VER)

Expand Down Expand Up @@ -580,6 +589,12 @@ $(KPROMO):
$(GOLANGCI_LINT): # building golanci-lint from source is not recommended, so we are using the install script
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TOOLS_BIN_DIR) $(GOLANGCI_LINT_VER)

$(CLUSTERCTL):
# We don't install clusterctl using the go toolchain, because the upstream Makefile
# is required to build clusterctl correctly. See https://github.com/kubernetes-sigs/cluster-api/issues/3706
curl -sSfL -o $(CLUSTERCTL) $(CLUSTERCTL_RELEASE_URL)
chmod u+x $(CLUSTERCTL)

## --------------------------------------
## Lint / Verify
## --------------------------------------
Expand Down

0 comments on commit f1252c7

Please sign in to comment.