@@ -65,7 +65,8 @@ IMG ?= $(IMAGE):$(VERSION)
6565# Set the Operator SDK version to use.
6666# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
6767OPERATOR_SDK_VERSION ?= v1.35.0
68-
68+ # Set the path to Operator SDK - OPERATOR_SDK_VERSION will be ignored.
69+ OPERATOR_SDK ?= bin/operator-sdk
6970
7071# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
7172ifeq (,$(shell go env GOBIN) )
@@ -131,19 +132,6 @@ test-e2e: manifests generate fmt vet ## Run e2e tests.
131132test-metrics :
132133 go test -timeout 30m ./test/e2e -ginkgo.focus=" Argo CD metrics controller" -coverprofile cover.out -ginkgo.v
133134
134- .PHONY : operator-sdk
135- OPERATOR_SDK ?= $(LOCALBIN ) /operator-sdk
136- operator-sdk : # # Download operator-sdk locally if necessary.
137- ifeq (,$(wildcard $(OPERATOR_SDK ) ) )
138- @{ \
139- set -e ;\
140- mkdir -p $(dir $(OPERATOR_SDK)) ;\
141- OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
142- curl -sSLo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION)/operator-sdk_$${OS}_$${ARCH} ;\
143- chmod +x $(OPERATOR_SDK) ;\
144- }
145- endif
146-
147135.PHONY : test-route
148136test-route :
149137 go test -timeout 30m ./test/e2e -ginkgo.focus=" Argo CD ConsoleLink controller" -coverprofile cover.out -ginkgo.v
@@ -223,27 +211,17 @@ docker-push: ## Push container image with the manager.
223211
224212# #@ Build Dependencies
225213
226- # # Location to install dependencies to
227- LOCALBIN ?= $(shell pwd) /bin
228- $(LOCALBIN ) :
229- mkdir -p $(LOCALBIN )
214+ # Do not use OPERATOR_SDK variable not to overwrite the user provided path
215+ bin/operator-sdk :
216+ mkdir -p bin
217+ curl -sSLo bin/operator-sdk \
218+ https://github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION ) /operator-sdk_$(shell go env GOOS) _$(shell go env GOARCH)
219+ chmod +x bin/operator-sdk
230220
221+ # Install to bin/operator-sdk unless already there or explicit OPERATOR_SDK provided
231222.PHONY : operator-sdk
232- OPERATOR_SDK ?= $(LOCALBIN ) /operator-sdk
233- operator-sdk : # # Download operator-sdk locally if necessary.
234- ifeq (,$(wildcard $(OPERATOR_SDK ) ) )
235- ifeq (,$(shell which operator-sdk 2>/dev/null) )
236- @{ \
237- set -e ;\
238- mkdir -p $(dir $(OPERATOR_SDK)) ;\
239- OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
240- curl -sSLo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION)/operator-sdk_$${OS}_$${ARCH} ;\
241- chmod +x $(OPERATOR_SDK) ;\
242- }
243- else
244- OPERATOR_SDK = $(shell which operator-sdk)
245- endif
246- endif
223+ operator-sdk : $(OPERATOR_SDK )
224+ @$(OPERATOR_SDK ) version
247225
248226ifndef ignore-not-found
249227 ignore-not-found = false
0 commit comments