forked from syseleven/terraform-provider-metakube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
87 lines (75 loc) · 2.89 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
75
76
77
78
79
80
81
82
83
84
85
86
87
DOMAIN=syseleven.de
NAMESPACE=syseleven
PKG_NAME=metakube
BINARY=terraform-provider-${PKG_NAME}
VERSION=4.2.1
PLATFORM?=darwin_arm64
SWEEP_DIR?=./metakube
SWEEP?=all
export GOPATH?=$(shell go env GOPATH)
export GOPROXY=https://proxy.golang.org
export GO111MODULE=on
default: install
build: goimportscheck
go build -v -o ${BINARY}
install: build
mkdir -p ~/.terraform.d/plugins/${DOMAIN}/${NAMESPACE}/${PKG_NAME}/${VERSION}/${PLATFORM}
mv ${BINARY} ~/.terraform.d/plugins/${DOMAIN}/${NAMESPACE}/${PKG_NAME}/${VERSION}/${PLATFORM}
reset:
rm -rf terraform*
rm -rf .terraform*
make install
terraform init
test: goimportscheck
go test ./$(PKG_NAME)
testacc:
# Require following environment variables to be set:
# METAKUBE_TOKEN - access token
# METAKUBE_PROJECT_ID - id of the project
# METAKUBE_HOST - example https://metakube.syseleven.de
# METAKUBE_ANOTHER_USER_EMAIL - email of an existing user to test cluster access sharing
# METAKUBE_K8S_VERSION - the kubernetes version
# METAKUBE_K8S_OLDER_VERSION - lower kubernetes version then METAKUBE_K8S_VERSION
# METAKUBE_OPENSTACK_AUTH_URL
# METAKUBE_OPENSTACK_APPLICATION_CREDENTIALS_ID
# METAKUBE_OPENSTACK_APPLICATION_CREDENTIALS_SECRET
# METAKUBE_OPENSTACK_IMAGE - an image available for openstack clusters
# METAKUBE_OPENSTACK_IMAGE2 - another image available for openstack clusters
# METAKUBE_OPENSTACK_FLAVOR - openstack flavor to use
# METAKUBE_OPENSTACK_USERNAME - openstack credentials username
# METAKUBE_OPENSTACK_PASSWORD - openstack credentials password
# METAKUBE_OPENSTACK_TENANT - openstack tenant to use
# METAKUBE_OPENSTACK_NODE_DC - openstack node datacenter name
# METAKUBE_OPENSTACK_APPLICATION_CREDENTIALS_ID - openstack application credentials id
# METAKUBE_OPENSTACK_APPLICATION_CREDENTIALS_SECRET - openstack application credentials secret
# METAKUBE_AZURE_NODE_DC - azure node datacenter name
# METAKUBE_AZURE_NODE_SIZE
# METAKUBE_AZURE_CLIENT_ID
# METAKUBE_AZURE_CLIENT_SECRET
# METAKUBE_AZURE_TENANT_ID
# METAKUBE_AZURE_SUBSCRIPTION_ID
# METAKUBE_AWS_ACCESS_KEY_ID
# METAKUBE_AWS_ACCESS_KEY_SECRET
# METAKUBE_AWS_VPC_ID
# METAKUBE_AWS_NODE_DC
# METAKUBE_AWS_INSTANCE_TYPE
# METAKUBE_AWS_SUBNET_ID
# METAKUBE_AWS_AVAILABILITY_ZONE
# METAKUBE_AWS_DISK_SIZE
TF_ACC=1 go test ./$(PKG_NAME) -v -timeout 120m $(TESTARGS)
sweep:
@echo "WARNING: This will destroy infrastructure. Use only in development accounts."
go test $(SWEEP_DIR) -v -sweep=$(SWEEP) $(SWEEPARGS) -timeout 60m
vet:
@go vet $$(go list ./... | grep -v vendor/) ; if [ $$? -eq 1 ]; then \
echo ""; \
echo "Vet found suspicious constructs. Please check the reported constructs"; \
echo "and fix them if necessary before submitting the code for review."; \
exit 1; \
fi
goimports:
@echo "==> Fixing source code with goimports..."
goimports -w $(PKG_NAME)
goimportscheck:
@sh -c "'$(CURDIR)/scripts/goimportscheck.sh'"
.PHONY: build install test testacc sweep vet goimports goimportscheck