Makefile 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. # set the shell to bash always
  2. SHELL := /usr/bin/env bash
  3. # set make and shell flags to exit on errors
  4. MAKEFLAGS += --warn-undefined-variables
  5. .SHELLFLAGS := -euo pipefail -c
  6. ARCH ?= amd64 arm64 ppc64le
  7. BUILD_ARGS ?= CGO_ENABLED=0
  8. DOCKER_BUILD_ARGS ?=
  9. DOCKERFILE ?= Dockerfile
  10. DOCKER ?= docker
  11. # default target is build
  12. .DEFAULT_GOAL := all
  13. .PHONY: all
  14. all: $(addprefix build-,$(ARCH))
  15. # Image registry for build/push image targets
  16. export IMAGE_REGISTRY ?= ghcr.io
  17. export IMAGE_REPO ?= external-secrets/external-secrets
  18. export IMAGE_NAME ?= $(IMAGE_REGISTRY)/$(IMAGE_REPO)
  19. BUNDLE_DIR ?= deploy/crds
  20. CRD_DIR ?= config/crds
  21. HELM_DIR ?= deploy/charts/external-secrets
  22. TF_DIR ?= terraform
  23. OUTPUT_DIR ?= bin
  24. # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
  25. ifeq (,$(shell go env GOBIN))
  26. GOBIN=$(shell go env GOPATH)/bin
  27. else
  28. GOBIN=$(shell go env GOBIN)
  29. endif
  30. # check if there are any existing `git tag` values
  31. ifeq ($(shell git tag),)
  32. # no tags found - default to initial tag `v0.0.0`
  33. export VERSION := $(shell echo "v0.0.0-$$(git rev-list HEAD --count)-g$$(git describe --dirty --always)" | sed 's/-/./2' | sed 's/-/./2')
  34. else
  35. # use tags
  36. export VERSION := $(shell git describe --dirty --always --tags --exclude 'helm*' | sed 's/-/./2' | sed 's/-/./2')
  37. endif
  38. TAG_SUFFIX ?=
  39. export IMAGE_TAG ?= $(VERSION)$(TAG_SUFFIX)
  40. # ====================================================================================
  41. # Colors
  42. BLUE := $(shell printf "\033[34m")
  43. YELLOW := $(shell printf "\033[33m")
  44. RED := $(shell printf "\033[31m")
  45. GREEN := $(shell printf "\033[32m")
  46. CNone := $(shell printf "\033[0m")
  47. # ====================================================================================
  48. # Logger
  49. TIME_LONG = `date +%Y-%m-%d' '%H:%M:%S`
  50. TIME_SHORT = `date +%H:%M:%S`
  51. TIME = $(TIME_SHORT)
  52. INFO = echo ${TIME} ${BLUE}[ .. ]${CNone}
  53. WARN = echo ${TIME} ${YELLOW}[WARN]${CNone}
  54. ERR = echo ${TIME} ${RED}[FAIL]${CNone}
  55. OK = echo ${TIME} ${GREEN}[ OK ]${CNone}
  56. FAIL = (echo ${TIME} ${RED}[FAIL]${CNone} && false)
  57. # ====================================================================================
  58. # Conformance
  59. reviewable: generate docs manifests helm.generate helm.schema.update helm.docs lint license.check helm.test.update test.crds.update tf.fmt ## Ensure a PR is ready for review.
  60. @GOWORK=off go -C hack/tools mod tidy # Tools and their deps are not to be included in project's GOWORK or in the project go.mod/sum. We consider them external.
  61. @GOWORK=off go -C hack/tools/gen-crd-api-reference-docs mod tidy
  62. @GOWORK=off go -C hack/tools/golangci-lint mod tidy
  63. @go mod tidy
  64. @cd e2e/ && go mod tidy
  65. @cd apis/ && go mod tidy
  66. @cd runtime/ && go mod tidy
  67. @for provider in providers/v1/*/; do (cd $$provider && go mod tidy); done
  68. @for generator in generators/v1/*/; do (cd $$generator && go mod tidy); done
  69. check-diff: reviewable ## Ensure branch is clean.
  70. @$(INFO) checking that branch is clean
  71. @status="$$(git status --porcelain)" && test -z "$$status" || (printf '%s\n' "$$status" && $(FAIL))
  72. @$(OK) branch is clean
  73. update-deps: ## Update dependencies across all modules (root, apis, runtime, e2e, providers, generators)
  74. @./hack/update-deps.sh
  75. .PHONY: license.check
  76. license.check:
  77. $(DOCKER) run --rm -u $(shell id -u) -v $(shell pwd):/github/workspace apache/skywalking-eyes:0.6.0 header check
  78. # ====================================================================================
  79. # Golang
  80. .PHONY: go-work ## Creates go workspace and syncs it
  81. go-work:
  82. @$(INFO) creating go workspace
  83. @rm -rf go.work go.work.sum
  84. @go work init
  85. @go work use -r .
  86. @go work edit -dropuse ./e2e -dropuse ./hack/tools -dropuse ./hack/tools/gen-crd-api-reference-docs -dropuse ./hack/tools/golangci-lint
  87. @go work sync
  88. @$(OK) created go workspace
  89. .PHONY: test
  90. test: generate envtest ## Run tests
  91. @$(INFO) go test unit-tests
  92. @set -e; \
  93. snap=$$(mktemp); \
  94. ./hack/modfiles.sh snapshot "$$snap"; \
  95. trap "./hack/modfiles.sh restore $$snap" EXIT INT TERM; \
  96. $(MAKE) go-work; \
  97. KUBEBUILDER_ASSETS="$$($(ENVTEST) use $(KUBERNETES_VERSION) -p path --bin-dir $(LOCALBIN))" \
  98. go test -tags $(PROVIDER) work -v -race -coverprofile cover.out
  99. @$(OK) go test unit-tests
  100. .PHONY: test.e2e
  101. test.e2e: generate ## Run e2e tests
  102. @$(INFO) go test e2e-tests
  103. $(MAKE) -C ./e2e test
  104. @$(OK) go test e2e-tests
  105. .PHONY: test.e2e.managed
  106. test.e2e.managed: generate ## Run e2e tests managed
  107. @$(INFO) go test e2e-tests-managed
  108. $(MAKE) -C ./e2e test.managed
  109. @$(OK) go test e2e-tests-managed
  110. .PHONY: test.crds
  111. test.crds: cty crds.generate.tests ## Test CRDs for modification and backwards compatibility
  112. @$(INFO) $(CTY) test tests
  113. $(CTY) test tests
  114. @$(OK) No breaking CRD changes detected
  115. .PHONY: test.crds.update
  116. test.crds.update: cty crds.generate.tests ## Update the snapshots used by the CRD tests
  117. @$(INFO) $(CTY) test tests -u
  118. $(CTY) test tests -u
  119. @$(OK) Successfully updated all test snapshots
  120. .PHONY: build
  121. build: $(addprefix build-,$(ARCH)) ## Build binary
  122. PROVIDER ?= all_providers
  123. .PHONY: build-%
  124. build-%: generate ## Build binary for the specified arch
  125. @$(INFO) go build $*
  126. $(BUILD_ARGS) GOOS=linux GOARCH=$* \
  127. go build -tags $(PROVIDER) -o '$(OUTPUT_DIR)/external-secrets-linux-$*' main.go
  128. @$(OK) go build $*
  129. lint: golangci-lint ## Run golangci-lint (set LINT_TARGET to run on specific module, LINT_JOBS for parallel jobs)
  130. @if [ -n "$(LINT_TARGET)" ]; then \
  131. $(INFO) Running golangci-lint on $(LINT_TARGET); \
  132. (cd $(LINT_TARGET) && $(GOLANGCI_LINT) run ./...) || exit 1; \
  133. $(OK) Finished linting $(LINT_TARGET); \
  134. else \
  135. $(INFO) Running golangci-lint on all modules in parallel; \
  136. JOBS=$${LINT_JOBS:-1}; \
  137. TMPDIR=$$(mktemp -d); \
  138. GOLANGCI=$(GOLANGCI_LINT); \
  139. trap "rm -rf $$TMPDIR" EXIT; \
  140. export TMPDIR GOLANGCI; \
  141. find . -name go.mod -not -path "*/vendor/*" -not -path "*/e2e/*" -not -path "*/hack/tools/*" -not -path "*/node_modules/*" -exec dirname {} \; | \
  142. xargs -n 1 -P $$JOBS sh -c ' \
  143. module="$$0"; \
  144. name=$$(echo "$$module" | sed "s/[\/\.]/_/g"); \
  145. echo "Linting $$module"; \
  146. if (cd "$$module" && $$GOLANGCI run ./... 2>&1); then \
  147. echo "✓ $$module" > "$$TMPDIR/$$name.success"; \
  148. else \
  149. echo "✗ $$module" > "$$TMPDIR/$$name.failed"; \
  150. exit 1; \
  151. fi \
  152. '; \
  153. FAILED=$$(find $$TMPDIR -name "*.failed" 2>/dev/null | wc -l | tr -d " "); \
  154. SUCCESS=$$(find $$TMPDIR -name "*.success" 2>/dev/null | wc -l | tr -d " "); \
  155. echo "Results: $$SUCCESS passed, $$FAILED failed"; \
  156. if [ $$FAILED -ne 0 ]; then \
  157. echo "Failed modules:"; \
  158. cat $$TMPDIR/*.failed 2>/dev/null || true; \
  159. $(ERR) Linting failed in $$FAILED module\(s\); \
  160. exit 1; \
  161. fi; \
  162. $(OK) Finished linting all modules; \
  163. fi
  164. generate: controller-gen ## Generate code and crds
  165. @CONTROLLER_GEN=$(CONTROLLER_GEN) ./hack/crd.generate.sh $(BUNDLE_DIR) $(CRD_DIR)
  166. @$(OK) Finished generating deepcopy and crds
  167. # ====================================================================================
  168. # Local Utility
  169. # This is for running out-of-cluster locally, and is for convenience.
  170. # For more control, try running the binary directly with different arguments.
  171. run: generate ## Run app locally (without a k8s cluster)
  172. go run -tags $(PROVIDER) ./main.go
  173. manifests: helm.generate ## Generate manifests from helm chart
  174. mkdir -p $(OUTPUT_DIR)/deploy/manifests
  175. helm dependency build $(HELM_DIR)
  176. helm template external-secrets $(HELM_DIR) -f deploy/manifests/helm-values.yaml > $(OUTPUT_DIR)/deploy/manifests/external-secrets.yaml
  177. crds.install: generate ## Install CRDs into a cluster. This is for convenience
  178. kubectl apply -f $(BUNDLE_DIR) --server-side
  179. crds.uninstall: ## Uninstall CRDs from a cluster. This is for convenience
  180. kubectl delete -f $(BUNDLE_DIR)
  181. crds.generate.tests:
  182. ./hack/test.crds.generate.sh $(BUNDLE_DIR) tests/crds
  183. @$(OK) Finished generating crds for testing
  184. tilt-up: tilt manifests ## Generates the local manifests that tilt will use to deploy the controller's objects.
  185. $(LOCALBIN)/tilt up
  186. # ====================================================================================
  187. # Helm Chart
  188. helm.docs: ## Generate helm docs
  189. @cd $(HELM_DIR); \
  190. $(DOCKER) run --rm -v $(shell pwd)/$(HELM_DIR):/helm-docs -u $(shell id -u) docker.io/jnorwood/helm-docs:v1.14.2
  191. HELM_VERSION ?= $(shell helm show chart $(HELM_DIR) | grep '^version:' | sed 's/version: //g')
  192. helm.build: helm.generate ## Build helm chart
  193. @$(INFO) helm package
  194. @helm package $(HELM_DIR) --dependency-update --destination $(OUTPUT_DIR)/chart
  195. @mv $(OUTPUT_DIR)/chart/external-secrets-$(HELM_VERSION).tgz $(OUTPUT_DIR)/chart/external-secrets.tgz
  196. @$(OK) helm package
  197. # install_helm_plugin is for installing the provided plugin, if it doesn't exist
  198. # $1 - plugin name
  199. # $2 - plugin version
  200. # $3 - plugin url
  201. define install_helm_plugin
  202. @v=$$(helm plugin list | awk '$$1=="$(1)"{print $$2}'); \
  203. if [ -z "$$v" ]; then \
  204. $(INFO) "Installing $(1) v$(2)"; \
  205. helm plugin install --version $(2) $(3); \
  206. $(OK) "Installed $(1) v$(2)"; \
  207. elif [ "$$v" != "$(2)" ]; then \
  208. $(INFO) "Found $(1) $$v. Reinstalling v$(2)"; \
  209. helm plugin remove $(1); \
  210. helm plugin install --version $(2) $(3); \
  211. $(OK) "Reinstalled $(1) v$(2)"; \
  212. else \
  213. $(OK) "$(1) already at v$(2)"; \
  214. fi
  215. endef
  216. HELM_SCHEMA_NAME := schema
  217. HELM_SCHEMA_VER := 2.2.1
  218. HELM_SCHEMA_URL := https://github.com/losisin/helm-values-schema-json.git
  219. helm.schema.plugin:
  220. $(call install_helm_plugin,$(HELM_SCHEMA_NAME),$(HELM_SCHEMA_VER), $(HELM_SCHEMA_URL))
  221. HELM_UNITTEST_PLUGIN_NAME := unittest
  222. HELM_UNITTEST_PLUGIN_VER := 1.0.0
  223. HELM_UNITTEST_PLUGIN_URL := https://github.com/helm-unittest/helm-unittest.git
  224. helm.unittest.plugin:
  225. $(call install_helm_plugin,$(HELM_UNITTEST_PLUGIN_NAME),$(HELM_UNITTEST_PLUGIN_VER), $(HELM_UNITTEST_PLUGIN_URL))
  226. helm.schema.update: helm.schema.plugin
  227. @$(INFO) Generating values.schema.json
  228. @helm schema -f $(HELM_DIR)/values.yaml -o $(HELM_DIR)/values.schema.json
  229. @$(OK) Generated values.schema.json
  230. helm.generate:
  231. ./hack/helm.generate.sh $(BUNDLE_DIR) $(HELM_DIR)
  232. @$(OK) Finished generating helm chart files
  233. helm.test: helm.unittest.plugin helm.generate
  234. @helm unittest deploy/charts/external-secrets/
  235. helm.test.update: helm.unittest.plugin helm.generate
  236. @helm unittest -u deploy/charts/external-secrets/
  237. helm.update.appversion:
  238. @chartversion=$$(yq .version ./deploy/charts/external-secrets/Chart.yaml) ; \
  239. chartappversion=$$(yq .appVersion ./deploy/charts/external-secrets/Chart.yaml) ; \
  240. chartname=$$(yq .name ./deploy/charts/external-secrets/Chart.yaml) ; \
  241. $(INFO) Update chartname and chartversion string in test snapshots.; \
  242. sed -s -i "s/^\([[:space:]]\+helm\.sh\/chart:\).*/\1 $${chartname}-$${chartversion}/" ./deploy/charts/external-secrets/tests/__snapshot__/*.yaml.snap ; \
  243. sed -s -i "s/^\([[:space:]]\+app\.kubernetes\.io\/version:\).*/\1 $${chartappversion}/" ./deploy/charts/external-secrets/tests/__snapshot__/*.yaml.snap ; \
  244. sed -s -i "s/^\([[:space:]]\+image: ghcr\.io\/external-secrets\/external-secrets:\).*/\1$${chartappversion}/" ./deploy/charts/external-secrets/tests/__snapshot__/*.yaml.snap ; \
  245. $(OK) "Version strings updated"
  246. # ====================================================================================
  247. # Documentation
  248. .PHONY: docs
  249. docs: generate ## Generate docs
  250. $(MAKE) -C ./hack/api-docs build
  251. .PHONY: docs.publish
  252. docs.publish: generate ## Generate and deploys docs
  253. $(MAKE) -C ./hack/api-docs build.publish
  254. .PHONY: docs.serve
  255. docs.serve: ## Serve docs
  256. $(MAKE) -C ./hack/api-docs serve
  257. DOCS_VERSION ?= $(VERSION)
  258. .PHONY: docs.update
  259. docs.update: ## Update docs
  260. $(MAKE) -C ./hack/api-docs stability-support.update DOCS_VERSION=$(DOCS_VERSION)
  261. # ====================================================================================
  262. # Build Artifacts
  263. .PHONY: build.all
  264. build.all: docker.build helm.build ## Build all artifacts (docker image, helm chart)
  265. .PHONY: docker.image
  266. docker.image: ## Emit IMAGE_NAME:IMAGE_TAG
  267. @echo $(IMAGE_NAME):$(IMAGE_TAG)
  268. .PHONY: docker.imagename
  269. docker.imagename: ## Emit IMAGE_NAME
  270. @echo $(IMAGE_NAME)
  271. .PHONY: docker.tag
  272. docker.tag: ## Emit IMAGE_TAG
  273. @echo $(IMAGE_TAG)
  274. .PHONY: docker.build
  275. docker.build: $(addprefix build-,$(ARCH)) ## Build the docker image
  276. @$(INFO) $(DOCKER) build
  277. echo $(DOCKER) buildx build -f $(DOCKERFILE) . $(DOCKER_BUILD_ARGS) -t $(IMAGE_NAME):$(IMAGE_TAG)
  278. $(DOCKER) buildx build -f $(DOCKERFILE) . $(DOCKER_BUILD_ARGS) -t $(IMAGE_NAME):$(IMAGE_TAG)
  279. @$(OK) $(DOCKER) build
  280. .PHONY: docker.push
  281. docker.push: ## Push the docker image to the registry
  282. @$(INFO) $(DOCKER) push
  283. @$(DOCKER) push $(IMAGE_NAME):$(IMAGE_TAG)
  284. @$(OK) $(DOCKER) push
  285. # RELEASE_TAG is tag to promote. Default is promoting to main branch, but can be overriden
  286. # to promote a tag to a specific version.
  287. RELEASE_TAG ?= $(IMAGE_TAG)
  288. SOURCE_TAG ?= $(VERSION)$(TAG_SUFFIX)
  289. .PHONY: docker.promote
  290. docker.promote: ## Promote the docker image to the registry
  291. @$(INFO) promoting $(SOURCE_TAG) to $(RELEASE_TAG)
  292. $(DOCKER) manifest inspect --verbose $(IMAGE_NAME):$(SOURCE_TAG) > .tagmanifest
  293. for digest in $$(jq -r 'if type=="array" then .[] | select(.Descriptor.platform.architecture != "unknown") | .Descriptor.digest else .Descriptor.digest end' < .tagmanifest); do \
  294. $(DOCKER) pull $(IMAGE_NAME)@$$digest; \
  295. done
  296. $(DOCKER) manifest create $(IMAGE_NAME):$(RELEASE_TAG) \
  297. $$(jq -j 'if type=="array" then [.[] | select(.Descriptor.platform.architecture != "unknown")] | map("--amend $(IMAGE_NAME)@" + .Descriptor.digest) | join(" ") else "--amend $(IMAGE_NAME)@" + .Descriptor.digest end' < .tagmanifest)
  298. $(DOCKER) manifest push $(IMAGE_NAME):$(RELEASE_TAG)
  299. @$(OK) $(DOCKER) push $(RELEASE_TAG) \
  300. # ====================================================================================
  301. # Terraform
  302. define run_terraform
  303. @cd $(TF_DIR)/$1/infrastructure && \
  304. terraform init && \
  305. $2 && \
  306. cd ../kubernetes && \
  307. terraform init && \
  308. $3
  309. endef
  310. tf.plan.%:
  311. $(call run_terraform,$*,terraform plan,terraform plan)
  312. tf.apply.%:
  313. $(call run_terraform,$*,terraform apply -auto-approve,terraform apply -auto-approve)
  314. tf.destroy.%:
  315. @cd $(TF_DIR)/$*/kubernetes && \
  316. terraform init && \
  317. terraform destroy -auto-approve && \
  318. cd ../infrastructure && \
  319. terraform init && \
  320. terraform destroy -auto-approve
  321. tf.fmt:
  322. @cd $(TF_DIR) && \
  323. terraform fmt -recursive
  324. # ====================================================================================
  325. # Help
  326. .PHONY: help
  327. # only comments after make target name are shown as help text
  328. help: ## Displays this help message
  329. @echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/|/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s'|' | sort)"
  330. .PHONY: clean
  331. clean: ## Clean bins
  332. @$(INFO) clean
  333. @rm -f $(OUTPUT_DIR)/external-secrets-linux-*
  334. @$(OK) go build $*
  335. # ====================================================================================
  336. # Build Dependencies
  337. detected_OS := $(shell uname -s)
  338. real_OS := $(detected_OS)
  339. arch := $(shell uname -m)
  340. ifeq ($(detected_OS),Darwin)
  341. detected_OS := mac
  342. real_OS := darwin
  343. endif
  344. ifeq ($(detected_OS),Linux)
  345. detected_OS := linux
  346. real_OS := linux
  347. endif
  348. ## Location to install dependencies to
  349. LOCALBIN ?= $(shell pwd)/bin
  350. $(LOCALBIN):
  351. mkdir -p $(LOCALBIN)
  352. ## Tool Binaries
  353. TILT ?= $(LOCALBIN)/tilt
  354. CTY ?= $(LOCALBIN)/cty
  355. ENVTEST ?= $(LOCALBIN)/setup-envtest
  356. CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
  357. GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
  358. DLV ?= $(LOCALBIN)/dlv
  359. CRANE ?= $(LOCALBIN)/crane
  360. GEN_CRD_API_REFERENCE_DOCS ?= $(LOCALBIN)/gen-crd-api-reference-docs
  361. LINT_TARGET ?= ""
  362. ## Tool Versions
  363. KUBERNETES_VERSION := 1.33.x
  364. TILT_VERSION := 0.33.21
  365. CTY_VERSION := 1.1.3
  366. .PHONY: envtest
  367. envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
  368. $(ENVTEST): Makefile hack/tools/go.mod hack/tools/go.sum | $(LOCALBIN)
  369. GOWORK=off GOBIN=$(abspath $(LOCALBIN)) go -C hack/tools install -mod=readonly sigs.k8s.io/controller-runtime/tools/setup-envtest
  370. .PHONY: controller-gen
  371. controller-gen: $(CONTROLLER_GEN) ## Build controller-gen locally if necessary.
  372. $(CONTROLLER_GEN): Makefile hack/tools/go.mod hack/tools/go.sum
  373. mkdir -p $(dir $@)
  374. GOWORK=off go -C hack/tools build -mod=readonly -o $(abspath $@) sigs.k8s.io/controller-tools/cmd/controller-gen
  375. .PHONY: gen-crd-api-reference-docs
  376. gen-crd-api-reference-docs: $(GEN_CRD_API_REFERENCE_DOCS) ## Download gen-crd-api-reference-docs locally if necessary.
  377. $(GEN_CRD_API_REFERENCE_DOCS): Makefile hack/tools/gen-crd-api-reference-docs/go.mod hack/tools/gen-crd-api-reference-docs/go.sum
  378. mkdir -p $(dir $@)
  379. GOWORK=off go -C hack/tools/gen-crd-api-reference-docs build -mod=readonly -o $(abspath $@) github.com/ahmetb/gen-crd-api-reference-docs
  380. .PHONY: golangci-lint
  381. golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
  382. $(GOLANGCI_LINT): Makefile hack/tools/golangci-lint/go.mod hack/tools/golangci-lint/go.sum | $(LOCALBIN)
  383. GOWORK=off GOBIN=$(abspath $(LOCALBIN)) go -C hack/tools/golangci-lint install -mod=readonly github.com/golangci/golangci-lint/v2/cmd/golangci-lint
  384. .PHONY: dlv
  385. dlv: $(DLV) ## Build Delve locally for the Tilt debug image.
  386. $(DLV): Makefile hack/tools/go.mod hack/tools/go.sum | $(LOCALBIN)
  387. GOWORK=off CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOBIN=$(abspath $(LOCALBIN)) go -C hack/tools install -mod=readonly github.com/go-delve/delve/cmd/dlv
  388. .PHONY: crane
  389. crane: $(CRANE) ## Build crane locally if necessary.
  390. $(CRANE): Makefile hack/tools/go.mod hack/tools/go.sum | $(LOCALBIN)
  391. GOWORK=off GOBIN=$(abspath $(LOCALBIN)) go -C hack/tools install -mod=readonly github.com/google/go-containerregistry/cmd/crane
  392. .PHONY: tilt
  393. .PHONY: $(TILT)
  394. tilt: $(TILT) ## Download tilt locally if necessary. Architecture is locked at x86_64.
  395. $(TILT): $(LOCALBIN)
  396. test -s $(LOCALBIN)/tilt || curl -fsSL https://github.com/tilt-dev/tilt/releases/download/v$(TILT_VERSION)/tilt.$(TILT_VERSION).$(detected_OS).$(arch).tar.gz | tar -xz -C $(LOCALBIN) tilt
  397. .PHONY: cty
  398. .PHONY: $(CTY)
  399. cty: $(CTY) ## Download cty locally if necessary. Architecture is locked at x86_64.
  400. $(CTY): $(LOCALBIN)
  401. test -s $(LOCALBIN)/cty || curl -fsSL https://github.com/Skarlso/crd-to-sample-yaml/releases/download/v$(CTY_VERSION)/cty_$(real_OS)_amd64.tar.gz | tar -xz -C $(LOCALBIN) cty