@@ -187,7 +187,14 @@ tidy: ## Run go mod tidy on every mod file in the repo
187187
188188.PHONY : golangci-lint
189189golangci-lint :
190- test -s $(LOCALBIN ) /golangci-lint || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.59.1
190+ test -s $(LOCALBIN ) /golangci-lint || { \
191+ CURL_AUTH_HEADER=" " ; \
192+ if [ -n " $$ GITHUB_TOKEN" ]; then \
193+ echo " Using GitHub token for golangci-lint download" ; \
194+ CURL_AUTH_HEADER=" -H Authorization: token $$ GITHUB_TOKEN" ; \
195+ fi ; \
196+ curl -sSfL $$ CURL_AUTH_HEADER https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.59.1; \
197+ }
191198 $(LOCALBIN ) /golangci-lint run --fix
192199
193200MAX_PROCS := 5
@@ -322,7 +329,14 @@ $(KUSTOMIZE): $(LOCALBIN)
322329 echo " $( LOCALBIN) /kustomize version is not expected $( KUSTOMIZE_VERSION) . Removing it before installing." ; \
323330 rm -rf $(LOCALBIN ) /kustomize; \
324331 fi
325- test -s $(LOCALBIN ) /kustomize || { curl -Ss $( KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $( subst v,,$( KUSTOMIZE_VERSION) ) $( LOCALBIN) ; }
332+ test -s $(LOCALBIN ) /kustomize || { \
333+ CURL_AUTH_HEADER=" " ; \
334+ if [ -n " $$ GITHUB_TOKEN" ]; then \
335+ echo " Using GitHub token for kustomize download" ; \
336+ CURL_AUTH_HEADER=" -H Authorization: token $$ GITHUB_TOKEN" ; \
337+ fi ; \
338+ curl -Ss $$ CURL_AUTH_HEADER $(KUSTOMIZE_INSTALL_SCRIPT ) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION ) ) $(LOCALBIN ) ; \
339+ }
326340
327341.PHONY : controller-gen
328342controller-gen : gowork $(CONTROLLER_GEN ) # # Download controller-gen locally if necessary. If wrong version is installed, it will be overwritten.
@@ -352,7 +366,14 @@ kuttl-test: ## Run kuttl tests
352366.PHONY : kuttl
353367kuttl : $(KUTTL ) # # Download kubectl-kuttl locally if necessary.
354368$(KUTTL ) : $(LOCALBIN )
355- test -s $(LOCALBIN ) /kubectl-kuttl || curl -L -o $(LOCALBIN ) /kubectl-kuttl https://github.com/kudobuilder/kuttl/releases/download/v$(KUTTL_VERSION ) /kubectl-kuttl_$(KUTTL_VERSION ) _linux_x86_64
369+ test -s $(LOCALBIN ) /kubectl-kuttl || { \
370+ CURL_AUTH_HEADER=" " ; \
371+ if [ -n " $$ GITHUB_TOKEN" ]; then \
372+ echo " Using GitHub token for kuttl download" ; \
373+ CURL_AUTH_HEADER=" -H Authorization: token $$ GITHUB_TOKEN" ; \
374+ fi ; \
375+ curl -Ss -L $$ CURL_AUTH_HEADER -o $(LOCALBIN ) /kubectl-kuttl https://github.com/kudobuilder/kuttl/releases/download/v$(KUTTL_VERSION ) /kubectl-kuttl_$(KUTTL_VERSION ) _linux_x86_64; \
376+ }
356377 chmod +x $(LOCALBIN ) /kubectl-kuttl
357378
358379.PHONY : operator-sdk
@@ -364,7 +385,12 @@ ifeq (, $(shell which operator-sdk 2>/dev/null))
364385 set -e ;\
365386 mkdir -p $(dir $(OPERATOR_SDK)) ;\
366387 OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
367- curl -sSLo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION)/operator-sdk_$${OS}_$${ARCH} ;\
388+ CURL_AUTH_HEADER="" ;\
389+ if [ -n "$$GITHUB_TOKEN" ]; then \
390+ echo "Using GitHub token for operator-sdk download"; \
391+ CURL_AUTH_HEADER="-H Authorization: token $$GITHUB_TOKEN"; \
392+ fi ;\
393+ curl -sSL $$CURL_AUTH_HEADER -o $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION)/operator-sdk_$${OS}_$${ARCH} ;\
368394 chmod +x $(OPERATOR_SDK) ;\
369395 }
370396else
@@ -398,7 +424,12 @@ ifeq (,$(shell which opm 2>/dev/null))
398424 set -e ;\
399425 mkdir -p $(dir $(OPM)) ;\
400426 OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
401- curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.29.0/$${OS}-$${ARCH}-opm ;\
427+ CURL_AUTH_HEADER="" ;\
428+ if [ -n "$$GITHUB_TOKEN" ]; then \
429+ echo "Using GitHub token for opm download"; \
430+ CURL_AUTH_HEADER="-H Authorization: token $$GITHUB_TOKEN"; \
431+ fi ;\
432+ curl -sSL $$CURL_AUTH_HEADER -o $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.29.0/$${OS}-$${ARCH}-opm ;\
402433 chmod +x $(OPM) ;\
403434 }
404435else
@@ -408,9 +439,13 @@ endif
408439
409440.PHONY : yq
410441yq : $(LOCALBIN ) # # Download and install yq in local env
411- test -s $(LOCALBIN ) /yq || ( cd $( LOCALBIN) && \
412- wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64.tar.gz -O - | \
413- tar xz && mv yq_linux_amd64 $(LOCALBIN ) /yq )
442+ test -s $(LOCALBIN ) /yq || ( cd $( LOCALBIN) && \
443+ CURL_AUTH_HEADER=" " ; \
444+ if [ -n " $$ GITHUB_TOKEN" ]; then \
445+ echo " Using GitHub token for yq download" ; \
446+ CURL_AUTH_HEADER=" -H Authorization: token $$ GITHUB_TOKEN" ; \
447+ fi ; \
448+ curl -Ss -L $$ CURL_AUTH_HEADER https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64.tar.gz | tar xz && mv yq_linux_amd64 $(LOCALBIN ) /yq )
414449
415450.PHONY : oc
416451oc : $(LOCALBIN ) # # Download and install oc in local env
0 commit comments