-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
97 lines (87 loc) · 2.48 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
88
89
90
91
92
93
94
95
96
97
# VERSION holds the current version of aerospike-operator.
VERSION?=1.0.0
build: BIN?=operator
build: OUT?=bin/aerospike-operator
build: GOOS?=linux
build: GOARCH?=amd64
build: gen
@GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 go build \
-v \
-ldflags="-d -s -w -X github.com/travelaudience/aerospike-operator/pkg/versioning.OperatorVersion=$(VERSION)" \
-tags=netgo \
-installsuffix=netgo \
-o=$(OUT) ./cmd/$(BIN)/main.go
.PHONY: skaffold
skaffold: NAMESPACE := aerospike-operator
skaffold: PROFILE ?= minikube
skaffold: PROJECT_ID ?= aerospike-operator
skaffold: TARGET := operator
skaffold:
@NAMESPACE="$(NAMESPACE)" \
PROFILE="$(PROFILE)" \
PROJECT_ID="$(PROJECT_ID)" \
TARGET="$(TARGET)" \
./hack/skaffold/skaffold.sh
.PHONY: docker.operator
docker.operator: TAG?=$(VERSION)
docker.operator: IMG?=quay.io/travelaudience/aerospike-operator
docker.operator:
docker build -t $(IMG):$(TAG) -f ./Dockerfile .
.PHONY: docker.tools
docker.tools: TAG?=$(VERSION)
docker.tools: IMG?=quay.io/travelaudience/aerospike-operator-tools
docker.tools:
docker build -t $(IMG):$(TAG) -f ./Dockerfile.tools .
.PHONY: fmt
fmt:
./hack/update-fmt.sh
.PHONY: openapi
openapi: CONTAINER_NAME?=aerospike-operator-openapi
openapi: OPEN?=0
openapi: PORT?=8080
openapi:
@./hack/update-openapi.sh
ifeq ($(OPEN),1)
@docker rm -f $(CONTAINER_NAME) || true && docker run \
-d \
-e SWAGGER_JSON=/swagger.json \
--name $(CONTAINER_NAME) \
-p $(PORT):8080 \
-v $(PWD)/docs/design/swagger.json:/swagger.json \
swaggerapi/swagger-ui:3.17.4
@open http://localhost:$(PORT)/
endif
.PHONY: gen
gen:
@./hack/update-codegen.sh
.PHONY: test.unit
test.unit:
go test -v ./cmd/... ./pkg/...
.PHONY: test.e2e.build
test.e2e.build:
@GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go test -c \
-v \
-installsuffix=netgo \
-tags=netgo \
-ldflags='-d -s -w' \
-o=bin/aerospike-operator-e2e test/e2e/*.go
.PHONY: test.e2e
test.e2e: FOCUS ?=
test.e2e: GCS_BUCKET_NAME ?= aerospike-operator
test.e2e: NAMESPACE := aerospike-operator-e2e
test.e2e: PROFILE ?= minikube
test.e2e: PROJECT_ID ?= aerospike-operator
test.e2e: SKIP ?=
test.e2e: STORAGE_ADMIN_KEY_JSON_FILE ?= ./key.json
test.e2e: TARGET := e2e
test.e2e:
@kubectl delete namespace --ignore-not-found $(NAMESPACE)
@FOCUS=$(FOCUS) \
NAMESPACE=$(NAMESPACE) \
PROFILE=$(PROFILE) \
PROJECT_ID=$(PROJECT_ID) \
GCS_BUCKET_NAME=$(GCS_BUCKET_NAME) \
SKIP=$(SKIP) \
STORAGE_ADMIN_KEY_JSON_FILE=$(STORAGE_ADMIN_KEY_JSON_FILE) \
TARGET=$(TARGET) \
./hack/skaffold/skaffold.sh