Skip to content

Commit

Permalink
Stop make erroring on lack of kubectl
Browse files Browse the repository at this point in the history
* Converts which calls to silent posix-compliant command calls (dev/null
  will stop noise printing to screen)

* Moves $(error ... to command in rule rather than declaration (non-tabbed
  lines are always run in first pass of Makefile regardless of rule called)
  • Loading branch information
phantomjinx authored and squakez committed Mar 1, 2022
1 parent 8639eec commit 7baf7bf
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions script/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,11 @@ get-staging-repo:
@echo $(or ${STAGING_RUNTIME_REPO},https://repository.apache.org/content/repositories/snapshots@id=apache-snapshots@snapshots)

.PHONY: build build-kamel build-resources dep codegen images images-dev images-push images-push-staging test check test-integration clean release cross-compile package-examples set-version git-tag release-notes check-licenses generate-deepcopy generate-client generate-doc build-resources release-helm release-staging release-nightly get-staging-repo get-version build-submodules set-module-version bundle-kamelets generate-keda generate-strimzi
.PHONY: controller-gen kubectl kustomize operator-sdk

# find or download controller-gen if necessary
controller-gen:
ifeq (, $(shell which controller-gen))
ifeq (, $(shell command -v controller-gen 2> /dev/null))
@{ \
set -e ;\
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
Expand All @@ -390,18 +391,16 @@ ifeq (, $(shell which controller-gen))
}
CONTROLLER_GEN=$(GOBIN)/controller-gen
else
CONTROLLER_GEN=$(shell which controller-gen)
CONTROLLER_GEN=$(shell command -v controller-gen 2> /dev/null)
endif

.PHONY: kubectl kustomize operator-sdk

kubectl:
ifeq (, $(shell which kubectl))
$(error "No kubectl found in PATH. Please install and re-run")
ifeq (, $(shell command -v kubectl 2> /dev/null))
$(error "No kubectl found in PATH. Please install and re-run")
endif

kustomize:
ifeq (, $(shell which kustomize))
ifeq (, $(shell command -v kustomize 2> /dev/null))
@{ \
set -e ;\
KUSTOMIZE_GEN_TMP_DIR=$$(mktemp -d) ;\
Expand All @@ -412,11 +411,11 @@ ifeq (, $(shell which kustomize))
}
KUSTOMIZE=$(GOBIN)/kustomize
else
KUSTOMIZE=$(shell which kustomize)
KUSTOMIZE=$(shell command -v kustomize 2> /dev/null)
endif

operator-sdk:
ifeq (, $(shell which operator-sdk))
ifeq (, $(shell command -v operator-sdk 2> /dev/null))
@{ \
set -e ;\
if [ "$(shell uname -s 2>/dev/null || echo Unknown)" == "Darwin" ] ; then \
Expand All @@ -438,7 +437,7 @@ else
operator-sdk version | sed -n 's/.*"v\([^"]*\)".*/\1/p'; \
echo " If this is less than $(OPERATOR_SDK_VERSION) then please consider moving it aside and allowing the approved version to be downloaded."; \
}
OPERATOR_SDK=$(shell which operator-sdk)
OPERATOR_SDK=$(shell command -v operator-sdk 2> /dev/null)
endif

.PHONY: generate-crd $(BUNDLE_CAMEL_APIS) bundle bundle-build
Expand Down

0 comments on commit 7baf7bf

Please sign in to comment.