forked from nats-io/nats-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (34 loc) · 1.58 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
SHELL := /bin/bash
# build.e2e builds the nats-operator-e2e test binary.
.PHONY: build.e2e
build.e2e:
@GOOS=linux GOARCH=amd64 go test -tags e2e -c -o build/nats-operator-e2e ./test/e2e/*.go
# build.operator builds the nats-operator binary.
.PHONY: build.operator
build.operator: gen
@GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build \
-ldflags "-d -s -w -X github.com/nats-io/nats-operator/version.GitSHA=`git rev-parse --short HEAD`" \
-tags netgo \
-installsuffix cgo \
-o build/nats-operator ./cmd/operator/main.go
# e2e runs the end-to-end test suite.
.PHONY: e2e
e2e: FEATURE_GATE_CLUSTER_SCOPED ?= false
e2e: KUBECONFIG ?= $(HOME)/.kube/config
e2e: NAMESPACE ?= default
e2e:
FEATURE_GATE_CLUSTER_SCOPED=$(FEATURE_GATE_CLUSTER_SCOPED) MODE=run NAMESPACE=$(NAMESPACE) PROFILE=local TARGET=operator $(MAKE) run
FEATURE_GATE_CLUSTER_SCOPED=$(FEATURE_GATE_CLUSTER_SCOPED) MODE=run NAMESPACE=$(NAMESPACE) PROFILE=local TARGET=e2e $(MAKE) run
@go test -timeout 20m -tags e2e -v ./test/e2e/main_test.go -feature-gates=ClusterScoped=$(FEATURE_GATE_CLUSTER_SCOPED) -kubeconfig $(KUBECONFIG) -namespace $(NAMESPACE) -wait
# run deploys either nats-operator or nats-operator-e2e to the Kubernetes cluster targeted by the current kubeconfig.
.PHONY: run
run: FEATURE_GATE_CLUSTER_SCOPED ?= false
run: MODE ?= dev
run: NAMESPACE ?= default
run: PROFILE ?= local
run: TARGET ?= operator
run:
@FEATURE_GATE_CLUSTER_SCOPED=$(FEATURE_GATE_CLUSTER_SCOPED) MODE=$(MODE) NAMESPACE=$(NAMESPACE) PROFILE=$(PROFILE) TARGET=$(TARGET) $(PWD)/hack/skaffold.sh
# gen executes the code generation step.
gen:
@./hack/codegen.sh