Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit 97d3eb4

Browse files
author
Ryan Phillips
committed
detect terraform binary or print warning message
1 parent 506fed7 commit 97d3eb4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ LOCAL_OS:=$(shell uname | tr A-Z a-z)
88
GOFILES:=$(shell find . -name '*.go' | grep -v -E '(./vendor)')
99
GOPATH_BIN:=$(shell echo ${GOPATH} | awk 'BEGIN { FS = ":" }; { print $1 }')/bin
1010
LDFLAGS=-X github.com/kubernetes-incubator/bootkube/pkg/version.Version=$(shell $(CURDIR)/build/git-version.sh)
11+
TERRAFORM:=$(shell command -v terraform 2> /dev/null)
1112

1213
all: \
1314
_output/bin/$(LOCAL_OS)/bootkube \
@@ -31,7 +32,11 @@ release: \
3132

3233
check:
3334
@gofmt -l -s $(GOFILES) | read; if [ $$? == 0 ]; then gofmt -s -d $(GOFILES); exit 1; fi
34-
@terraform fmt -check ; if [ ! $$? -eq 0 ]; then exit 1; fi
35+
ifdef TERRAFORM
36+
$(TERRAFORM) fmt -check ; if [ ! $$? -eq 0 ]; then exit 1; fi
37+
else
38+
@echo -e "\e[91mSkipping terraform lint. terraform binary not available.\e[0m"
39+
endif
3540
@go vet $(shell go list ./... | grep -v '/vendor/')
3641
@./scripts/verify-gopkg.sh
3742
@go test -v $(shell go list ./... | grep -v '/vendor/\|/e2e')

0 commit comments

Comments
 (0)