-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (56 loc) · 1.32 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Provider metadata and versionning
PROVIDER = neuvector
VERSION = 0.4.4
RELEASE_VERSION ?= v$(VERSION)
# Terraform metadata for installation
BIN = terraform-provider-$(PROVIDER)
HOSTNAME = github.com
NAMESPACE = theobori
OS_ARCH ?= linux_amd64
# Terraform
TF_PLUGINS_DIR = ~/.terraform.d/plugins
TF_CACHE = $(shell find examples/ -name ".terraform*")
# Output binary paths
BIN_DIR = $(TF_PLUGINS_DIR)/$(HOSTNAME)/$(NAMESPACE)/$(PROVIDER)/$(VERSION)/$(OS_ARCH)
BIN_PATH = $(BIN_DIR)/$(BIN)
# Formatted Go files
GOFMT_FILES ?= $(shell find . -name "*.go")
NEUVECTOR_PATH = ./internal/resources/neuvector
TEST_FILES = $(NEUVECTOR_PATH)/data_source_eula_test.go \
$(NEUVECTOR_PATH)/resource_eula_test.go \
$(NEUVECTOR_PATH)/resource_registry_test.go
default: install
build:
go build -o $(BIN)
fmt:
gofmt -w $(GOFMT_FILES)
neuvector:
docker-compose up -d
testacc: clean_test
TF_ACC=1 go test -v $(TEST_FILES)
clean_test:
go clean -testcache
clean: clean_test
$(RM) -r $(BIN)
uninstall: clean
$(RM) -r $(BIN_DIR)
install: build
mkdir -p $(BIN_DIR)
mv $(BIN) $(BIN_PATH)
release:
git tag $(RELEASE_VERSION)
git push origin $(RELEASE_VERSION)
fclean: clean uninstall
$(RM) -r $(TF_CACHE)
re: fclean build install
.PHONY: \
build \
install \
release \
uninstall \
fmt \
testacc \
neuvector \
clean_test \
clean \
re