forked from EnMasseProject/enmasse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
182 lines (137 loc) · 3.75 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
TOPDIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(TOPDIR)/Makefile.env.mk
GO_DIRS = \
controller-manager \
console/console-server \
broker-plugin
DOCKER_DIRS = \
agent \
topic-forwarder \
address-space-controller \
none-authservice \
standard-controller \
keycloak-plugin \
service-broker \
console/console-init \
olm-manifest
FULL_BUILD = true
GOOPTS ?= -mod=vendor
DOCKER_TARGETS = docker_build docker_tag docker_push kind_load_image clean
INSTALLDIR = $(CURDIR)/templates/install
SKIP_TESTS ?= false
SKIP_MANIFESTS ?= false
MAVEN_BATCH ?= true
ifndef GOPATH
GOPATH=/tmp/go
endif
ifeq ($(SKIP_TESTS),true)
MAVEN_ARGS+=-DskipTests -Dmaven.test.skip=true
endif
ifeq ($(MAVEN_BATCH),true)
MAVEN_ARGS+=-B
endif
all: build_java build_go templates
templates: imageenv manifests
$(MAKE) -C templates
deploy: build_go
$(IMAGE_ENV) IMAGE_ENV="$(IMAGE_ENV)" mvn -Prelease deploy $(MAVEN_ARGS)
build_java: build_go templates
$(IMAGE_ENV) IMAGE_ENV="$(IMAGE_ENV)" mvn package $(MAVEN_ARGS)
build_go: $(GO_DIRS) test_go
olmindex:
$(MAKE) -C olm-index docker_build docker_tag
olmindex_push:
$(MAKE) -C olm-index docker_push
imageenv:
@echo $(IMAGE_ENV) > imageenv.txt
imagelist:
@echo $(IMAGE_LIST) > imagelist.txt
$(GO_DIRS):
$(MAKE) FULL_BUILD=$(FULL_BUILD) -C $@ $(MAKECMDGOALS)
ifeq ($(SKIP_TESTS),true)
test_go:
else
test_go: test_go_vet test_go_codegen test_go_run
endif
test_go_codegen:
GO111MODULE=on ./hack/verify-codegen.sh
test_go_vet:
GO111MODULE=on go vet $(GOOPTS) ./cmd/... ./pkg/...
ifeq (,$(GO2XUNIT))
test_go_run:
GO111MODULE=on go test $(GOOPTS) -v ./...
else
test_go_run:
mkdir -p build
GO111MODULE=on go test $(GOOPTS) -v ./... 2>&1 | tee $(abspath build/go.testoutput)
$(GO2XUNIT) -fail -input build/go.testoutput -output build/TEST-go.xml
endif
coverage_go:
GO111MODULE=on go test $(GOOPTS) -cover ./...
buildpush:
$(MAKE)
$(MAKE) docker_build
$(MAKE) docker_tag
$(MAKE) docker_push
buildpushkind:
$(MAKE)
$(MAKE) docker_build
$(MAKE) docker_tag
$(MAKE) kind_load_image
clean_java:
mvn -q clean $(MAVEN_ARGS)
template_clean:
$(MAKE) -C templates clean
clean: clean_java clean_go docu_clean template_clean
rm -rf build
clean_go:
rm -Rf go-bin
coverage: java_coverage
$(MAKE) FULL_BUILD=$(FULL_BUILD) -C $@ coverage
java_coverage:
mvn test -Pcoverage $(MAVEN_ARGS)
mvn jacoco:report-aggregate $(MAVEN_ARGS)
$(DOCKER_TARGETS): $(DOCKER_DIRS) $(GO_DIRS)
$(DOCKER_DIRS):
$(MAKE) FULL_BUILD=$(FULL_BUILD) -C $@ $(MAKECMDGOALS)
systemtests:
make -C systemtests
systemtests-tekton:
make -C systemtests systemtests-tekton
docu_html:
make -C documentation
docu_check:
make -C documentation check
docu_clean:
make -C documentation clean
#region Targets related to kubebuilder
ifeq (, $(shell which controller-gen 2>/dev/null))
LOCALBIN:=$(TOPDIR)/local/go/bin
CONTROLLER_GEN:=$(abspath $(LOCALBIN)/controller-gen )
controller-gen: $(CONTROLLER_GEN)
$(CONTROLLER_GEN):
@mkdir -p "$(LOCALBIN)"
@{ \
set -e ;\
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
GOPATH=$(abspath $(LOCALBIN)/../) go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.3.0 ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
else
controller-gen:
.PHONY: controller-gen
CONTROLLER_GEN:=$(shell which controller-gen)
endif
ifeq ($(SKIP_MANIFESTS),true)
manifests:
@echo "Skipping generating manifests from source"
else
manifests: controller-gen
$(CONTROLLER_GEN) crd paths=./pkg/apis/enmasse/v1beta2 output:dir=./templates/shared-infra
endif
#endregion
.PHONY: test_go_vet test_go_plain build_go imageenv buildpushkind
.PHONY: all $(GO_DIRS) $(DOCKER_TARGETS) $(DOCKER_DIRS) build_java test_go systemtests clean_java docu_html docu_check docu_clean templates
.PHONY: manifests