Skip to content

Commit

Permalink
Merge pull request #66 from heyealex/add-version-reqs
Browse files Browse the repository at this point in the history
Add version requirements
  • Loading branch information
heyealex authored Dec 23, 2021
2 parents 885a5e3 + 8d353e9 commit 1bfd139
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
42 changes: 40 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
.PHONY: tests fmt vet test-engine test-resources test-examples packer \
packer-clean packer-check packer-docs add-google-license, \
check-tflint, check-pre-commit, install-deps-dev, ghpc-dev
check-tflint, check-pre-commit, install-deps-dev, ghpc-dev, \
check-deps, check-terraform-exists, check-packer-exists, \
check-terraform-version, check-packer-version
RES = ./resources
ENG = ./cmd/... ./pkg/...
SRC = $(ENG) $(RES)/tests/...
TF_VERSION_CHECK=$(shell expr `terraform version | head -n1 | cut -f 2- -d ' ' | cut -c 2-` \>= 0.14)
PK_VERSION_CHECK=$(shell expr `packer version | head -n1 | cut -f 2- -d ' ' | cut -c 2-` \>= 1.6)
PACKER_FOLDERS=$(shell find ${RES} -type f -name "*.pkr.hcl" -not -path '*/\.*' -printf '%h\n' | sort -u)

ghpc: $(shell find ./cmd ./pkg ./resources ghpc.go -type f)
ghpc: check-deps $(shell find ./cmd ./pkg ./resources ghpc.go -type f)
$(info **************** building ghpc ************************)
go build ghpc.go

Expand Down Expand Up @@ -50,6 +54,40 @@ packer-check:
packer fmt -check $${folder}; \
done

check-deps: check-terraform-exists check-terraform-version check-packer-exists check-packer-version

ifeq (, $(shell which terraform))
check-terraform-exists:
$(error ERROR: terraform not installed, visit https://learn.hashicorp.com/tutorials/terraform/install-cli)
else
check-terraform-exists:

endif

ifneq ("$(TF_VERSION_CHECK)", "1")
check-terraform-version:
$(error ERROR: terraform version must be greater than 0.14, update at https://learn.hashicorp.com/tutorials/terraform/install-cli)
else
check-terraform-version:

endif

ifeq (, $(shell which packer))
check-packer-exists:
$(error ERROR: packer not installed, visit https://learn.hashicorp.com/tutorials/packer/get-started-install-cli)
else
check-packer-exists:

endif

ifneq ("$(PK_VERSION_CHECK)", "1")
check-packer-version:
$(error ERROR: packer version must be greater than 1.6.6, update at https://learn.hashicorp.com/tutorials/packer/get-started-install-cli)
else
check-packer-version:

endif

ifeq (, $(shell which pre-commit))
check-pre-commit:
$(info WARNING: pre-commit not installed, visit https://pre-commit.com/ for installation instructions.)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ manner. The HPC Toolkit is designed to be highly customizable and extensible,
and intends to address the HPC deployment needs of a broad range of customers.

## Dependencies
* [Terraform](https://www.terraform.io/downloads.html)
* [Packer](https://www.packer.io/downloads)
* [Terraform](https://www.terraform.io/downloads.html): version 0.14 or greater
* [Packer](https://www.packer.io/downloads): version 1.6.0 or greater
* [golang](https://golang.org/doc/install)
* To setup GOPATH and development environment: `export PATH=$PATH:$(go env GOPATH)/bin`

Expand Down

0 comments on commit 1bfd139

Please sign in to comment.