-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
392 lines (302 loc) · 14 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# distro for package building (oneof: xenial, centos-7-x86_64)
DISTRIBUTION ?= none
RELEASE ?= $(shell cat ./RELEASE)
DOCKER_RELEASE ?= development
DOCKER_REG_NAME ?= "docker.onedata.org"
DOCKER_REG_USER ?= ""
DOCKER_REG_PASSWORD ?= ""
DOCKER_BASE_IMAGE ?= "ubuntu:16.04"
DOCKER_DEV_BASE_IMAGE ?= "onedata/worker:1802-1"
ifeq ($(strip $(ONEPROVIDER_VERSION)),)
ONEPROVIDER_VERSION := $(shell git describe --tags --always)
endif
ifeq ($(strip $(COUCHBASE_VERSION)),)
COUCHBASE_VERSION := 4.5.1-2844
endif
ifeq ($(strip $(CLUSTER_MANAGER_VERSION)),)
CLUSTER_MANAGER_VERSION := $(shell git -C cluster_manager describe --tags --always)
endif
ifeq ($(strip $(OP_WORKER_VERSION)),)
OP_WORKER_VERSION := $(shell git -C op_worker describe --tags --always)
endif
ifeq ($(strip $(OP_PANEL_VERSION)),)
OP_PANEL_VERSION := $(shell git -C onepanel describe --tags --always)
endif
ifeq ($(strip $(ONECLIENT_VERSION)),)
ONECLIENT_VERSION := $(shell git -C oneclient describe --tags --always)
endif
ONEPROVIDER_VERSION := $(shell echo ${ONEPROVIDER_VERSION} | tr - .)
CLUSTER_MANAGER_VERSION := $(shell echo ${CLUSTER_MANAGER_VERSION} | tr - .)
OP_WORKER_VERSION := $(shell echo ${OP_WORKER_VERSION} | tr - .)
OP_PANEL_VERSION := $(shell echo ${OP_PANEL_VERSION} | tr - .)
ONECLIENT_VERSION := $(shell echo ${ONECLIENT_VERSION} | tr - .)
ONEPROVIDER_BUILD ?= 1
ONECLIENT_FPMPACKAGE_TMP ?= package_fpm
ifdef IGNORE_XFAIL
TEST_RUN := ./test_run.py --ignore-xfail
else
TEST_RUN := ./test_run.py
endif
ifdef ENV_FILE
TEST_RUN := $(TEST_RUN) --env-file $(ENV_FILE)
endif
GIT_URL := $(shell git config --get remote.origin.url | sed -e 's/\(\/[^/]*\)$$//g')
GIT_URL := $(shell if [ "${GIT_URL}" = "file:/" ]; then echo 'ssh://[email protected]:7999/vfs'; else echo ${GIT_URL}; fi)
ONEDATA_GIT_URL := $(shell if [ "${ONEDATA_GIT_URL}" = "" ]; then echo ${GIT_URL}; else echo ${ONEDATA_GIT_URL}; fi)
export ONEDATA_GIT_URL
.PHONY: docker docker-dev package.tar.gz
all: build
##
## Macros
##
NO_CACHE := $(shell if [ "${NO_CACHE}" != "" ]; then echo "--no-cache"; fi)
make = $(1)/make.py -s $(1) -r . $(NO_CACHE)
clean = $(call make, $(1)) clean
make_rpm = $(call make, $(1)) -e DISTRIBUTION=$(DISTRIBUTION) -e RELEASE=$(RELEASE) --privileged --group mock -i onedata/rpm_builder:$(DISTRIBUTION)-$(RELEASE) $(2)
mv_rpm = mv $(1)/package/packages/*.src.rpm package/$(DISTRIBUTION)/SRPMS && \
mv $(1)/package/packages/*.x86_64.rpm package/$(DISTRIBUTION)/x86_64
make_deb = $(call make, $(1)) -e DISTRIBUTION=$(DISTRIBUTION) --privileged --group sbuild -i onedata/deb_builder:$(DISTRIBUTION)-$(RELEASE) $(2)
mv_deb = mv $(1)/package/packages/*_amd64.deb package/$(DISTRIBUTION)/binary-amd64 && \
mv $(1)/package/packages/*.tar.gz package/$(DISTRIBUTION)/source | true && \
mv $(1)/package/packages/*.dsc package/$(DISTRIBUTION)/source | true && \
mv $(1)/package/packages/*.debian.tar.xz package/$(DISTRIBUTION)/source | true && \
mv $(1)/package/packages/*_amd64.changes package/$(DISTRIBUTION)/sourcea | true
unpack = tar xzf $(1).tar.gz
get_release:
@echo $(RELEASE)
##
## Submodules
##
branch = $(shell git rev-parse --abbrev-ref HEAD)
submodules:
git submodule sync --recursive ${submodule}
git submodule update --init --recursive ${submodule}
##
## Build
##
build: build_appmock build_oz_worker build_oneclient build_op_worker \
build_cluster_manager build_cluster_worker build_onepanel
build_appmock: submodules
$(call make, appmock)
build_oz_worker: submodules
$(call make, oz_worker)
build_oneclient: submodules
$(call make, oneclient) deb-info
build_op_worker: submodules
$(call make, op_worker)
build_cluster_manager: submodules
$(call make, cluster_manager)
build_cluster_worker: submodules
$(call make, cluster_worker)
build_onepanel: submodules
$(call make, onepanel)
##
## Artifacts
##
artifact: artifact_appmock artifact_oneclient artifact_op_worker \
artifact_oz_worker artifact_cluster_manager artifact_cluster_worker \
artifact_onepanel
artifact_appmock:
$(call unpack, appmock)
artifact_oneclient:
$(call unpack, oneclient)
artifact_op_worker:
$(call unpack, op_worker)
artifact_oz_worker:
$(call unpack, oz_worker)
artifact_cluster_manager:
$(call unpack, cluster_manager)
artifact_cluster_worker:
$(call unpack, cluster_worker)
artifact_onepanel:
$(call unpack, onepanel)
##
## Test
##
BROWSER ?= Chrome
RECORDING_OPTION ?= failed
test_env_up:
${TEST_RUN} --test-type env_up -vvv --test-dir tests/env_up
test_provider_packaging test_packaging:
${TEST_RUN} --test-type packaging -k "oneprovider" -vvv --test-dir tests/packaging -s
test_oneclient_base_packaging:
${TEST_RUN} --test-type packaging -k "oneclient_base" -vvv --test-dir tests/packaging -s
test_oneclient_packaging:
${TEST_RUN} --test-type packaging -k "oneclient and not oneclient_base" -vvv --test-dir tests/packaging -s
test:
${TEST_RUN} --test-type acceptance -vvv --test-dir tests/acceptance/scenarios/${SUITE}.py
test_performance:
${TEST_RUN} -s --test-type performance -vvv --test-dir tests/performance
test_performance_dd:
${TEST_RUN} -s --test-type performance -vvv --test-dir tests/performance -k test_dd
test_performance_sysbench:
${TEST_RUN} -s --test-type performance -vvv --test-dir tests/performance -k sysbench
test_performance_files_creation:
${TEST_RUN} -s --test-type performance -vvv --test-dir tests/performance -k test_files_creation
test_performance_concurrent_files_creation:
${TEST_RUN} -s --test-type performance -vvv --test-dir tests/performance -k concurrent_files_creation
test_performance_transfer_onf:
${TEST_RUN} -s --test-type performance -vvv --test-dir tests/performance -k transfer_onf
test_gui_env_up:
${TEST_RUN} --test-type gui -vvv --test-dir tests/gui/scenarios/${SUITE}.py -i onedata/acceptance_gui:v3 --driver=${BROWSER} --basetemp=./tests/gui/tmp_files --showlocals --xvfb --xvfb-recording=${RECORDING_OPTION}
test_acceptance_mixed:
${TEST_RUN} --test-type mixed -vvv --test-dir tests/mixed/scenarios/${SUITE}.py -i onedata/acceptance_mixed:v3 --driver=Chrome --xvfb --xvfb-recording=failed
test_profiling:
${TEST_RUN} --test-type acceptance -vvv --test-dir tests/acceptance/profiling
##
## Clean
##
clean_all: clean_appmock clean_oz_worker clean_oneclient \
clean_op_worker clean_onepanel clean_cluster_manager \
clean_cluster_worker clean_packages
clean_appmock:
$(call clean, appmock)
clean_onepanel:
$(call clean, onepanel)
clean_oz_worker:
$(call clean, oz_worker)
clean_op_worker:
$(call clean, op_worker)
clean_oneclient:
$(call clean, oneclient)
clean_cluster_manager:
$(call clean, cluster_manager)
clean_cluster_worker:
$(call clean, cluster_worker)
clean_packages:
rm -rf oneprovider_meta/oneprovider.spec \
oneprovider_meta/oneprovider/DEBIAN/control \
oneprovider_meta/package package oneclient_package_tmp
##
## RPM packaging
##
rpm: rpm_oneprovider rpm_oneclient
rpm_oneprovider: rpm_op_panel rpm_op_worker rpm_cluster_manager
cp -f oneprovider_meta/oneprovider.spec.template oneprovider_meta/oneprovider.spec
sed -i 's/{{scl}}/onedata$(RELEASE)/g' oneprovider_meta/oneprovider.spec
sed -i 's/{{oneprovider_version}}/$(ONEPROVIDER_VERSION)/g' oneprovider_meta/oneprovider.spec
sed -i 's/{{oneprovider_build}}/$(ONEPROVIDER_BUILD)/g' oneprovider_meta/oneprovider.spec
sed -i 's/{{couchbase_version}}/$(COUCHBASE_VERSION)/g' oneprovider_meta/oneprovider.spec
sed -i 's/{{cluster_manager_version}}/$(CLUSTER_MANAGER_VERSION)/g' oneprovider_meta/oneprovider.spec
sed -i 's/{{op_worker_version}}/$(OP_WORKER_VERSION)/g' oneprovider_meta/oneprovider.spec
sed -i 's/{{op_panel_version}}/$(OP_PANEL_VERSION)/g' oneprovider_meta/oneprovider.spec
bamboos/docker/make.py -i onedata/rpm_builder:$(DISTRIBUTION)-$(RELEASE) \
-e DISTRIBUTION=$(DISTRIBUTION) -e RELEASE=$(RELEASE) --privileged --group mock -c \
mock --buildsrpm --spec oneprovider_meta/oneprovider.spec \
--sources oneprovider_meta --root $(DISTRIBUTION) \
--resultdir oneprovider_meta/package/packages
bamboos/docker/make.py -i onedata/rpm_builder:$(DISTRIBUTION)-$(RELEASE) \
-e DISTRIBUTION=$(DISTRIBUTION) -e RELEASE=$(RELEASE) --privileged --group mock -c \
mock --rebuild oneprovider_meta/package/packages/*.src.rpm \
--root $(DISTRIBUTION) --resultdir oneprovider_meta/package/packages
$(call mv_rpm, oneprovider_meta)
rpm_op_panel: clean_onepanel rpmdirs
$(call make_rpm, onepanel, package) -e PKG_VERSION=$(OP_PANEL_VERSION) -e REL_TYPE=oneprovider
$(call mv_rpm, onepanel)
rpm_op_worker: clean_op_worker rpmdirs
$(call make_rpm, op_worker, package) -e PKG_VERSION=$(OP_WORKER_VERSION)
$(call mv_rpm, op_worker)
rpm_cluster_manager: clean_cluster_manager rpmdirs
$(call make_rpm, cluster_manager, package) -e PKG_VERSION=$(CLUSTER_MANAGER_VERSION)
$(call mv_rpm, cluster_manager)
rpm_oneclient_base: clean_oneclient rpmdirs
$(call make_rpm, oneclient, rpm) -e PKG_VERSION=$(ONECLIENT_VERSION)
$(call mv_rpm, oneclient)
rpmdirs:
mkdir -p package/$(DISTRIBUTION)/SRPMS package/$(DISTRIBUTION)/x86_64
##
## DEB packaging
##
deb: deb_oneprovider deb_oneclient
deb_oneprovider: deb_op_panel deb_op_worker deb_cluster_manager
cp -f oneprovider_meta/oneprovider/DEBIAN/control.template oneprovider_meta/oneprovider/DEBIAN/control
sed -i 's/{{oneprovider_version}}/$(ONEPROVIDER_VERSION)/g' oneprovider_meta/oneprovider/DEBIAN/control
sed -i 's/{{oneprovider_build}}/$(ONEPROVIDER_BUILD)/g' oneprovider_meta/oneprovider/DEBIAN/control
sed -i 's/{{couchbase_version}}/$(COUCHBASE_VERSION)/g' oneprovider_meta/oneprovider/DEBIAN/control
sed -i 's/{{cluster_manager_version}}/$(CLUSTER_MANAGER_VERSION)/g' oneprovider_meta/oneprovider/DEBIAN/control
sed -i 's/{{op_worker_version}}/$(OP_WORKER_VERSION)/g' oneprovider_meta/oneprovider/DEBIAN/control
sed -i 's/{{op_panel_version}}/$(OP_PANEL_VERSION)/g' oneprovider_meta/oneprovider/DEBIAN/control
bamboos/docker/make.py -s oneprovider_meta -r . -c 'dpkg-deb -b oneprovider'
mv oneprovider_meta/oneprovider.deb package/$(DISTRIBUTION)/binary-amd64/oneprovider_$(ONEPROVIDER_VERSION)-$(ONEPROVIDER_BUILD)_amd64.deb
deb_op_panel: clean_onepanel debdirs
$(call make_deb, onepanel, package) -e PKG_VERSION=$(OP_PANEL_VERSION) -e REL_TYPE=oneprovider
$(call mv_deb, onepanel)
deb_op_worker: clean_op_worker debdirs
$(call make_deb, op_worker, package) -e PKG_VERSION=$(OP_WORKER_VERSION)
$(call mv_deb, op_worker)
deb_cluster_manager: clean_cluster_manager debdirs
$(call make_deb, cluster_manager, package) -e PKG_VERSION=$(CLUSTER_MANAGER_VERSION)
$(call mv_deb, cluster_manager)
deb_oneclient_base: clean_oneclient debdirs
$(call make_deb, oneclient, deb) -e PKG_VERSION=$(ONECLIENT_VERSION)
$(call mv_deb, oneclient)
debdirs:
mkdir -p package/$(DISTRIBUTION)/source package/$(DISTRIBUTION)/binary-amd64
##
## Package artifact
##
package.tar.gz:
tar -chzf package.tar.gz package
##
## Docker artifact
##
docker: docker-dev
./docker_build.py --repository $(DOCKER_REG_NAME) --user $(DOCKER_REG_USER) \
--password $(DOCKER_REG_PASSWORD) \
--build-arg BASE_IMAGE=$(DOCKER_BASE_IMAGE) \
--build-arg RELEASE=$(RELEASE) \
--build-arg RELEASE_TYPE=$(DOCKER_RELEASE) \
--build-arg OP_PANEL_VERSION=$(OP_PANEL_VERSION) \
--build-arg COUCHBASE_VERSION=$(COUCHBASE_VERSION) \
--build-arg CLUSTER_MANAGER_VERSION=$(CLUSTER_MANAGER_VERSION) \
--build-arg OP_WORKER_VERSION=$(OP_WORKER_VERSION) \
--build-arg ONEPROVIDER_VERSION=$(ONEPROVIDER_VERSION) \
--name oneprovider \
--publish --remove docker
docker-dev:
./docker_build.py --repository $(DOCKER_REG_NAME) --user $(DOCKER_REG_USER) \
--password $(DOCKER_REG_PASSWORD) \
--build-arg BASE_IMAGE=$(DOCKER_DEV_BASE_IMAGE) \
--build-arg RELEASE=$(RELEASE) \
--build-arg OP_PANEL_VERSION=$(OP_PANEL_VERSION) \
--build-arg COUCHBASE_VERSION=$(COUCHBASE_VERSION) \
--build-arg CLUSTER_MANAGER_VERSION=$(CLUSTER_MANAGER_VERSION) \
--build-arg OP_WORKER_VERSION=$(OP_WORKER_VERSION) \
--build-arg ONEPROVIDER_VERSION=$(ONEPROVIDER_VERSION) \
--report docker-dev-build-report.txt \
--short-report docker-dev-build-list.json \
--name oneprovider-dev \
--publish --remove docker
#
# Build intermediate Oneclient Docker image with oneclient installed from
# a normal (oneclient-base) package into /usr/ prefix.
#
docker_oneclient_base:
$(MAKE) -C oneclient docker-base PKG_VERSION=$(ONECLIENT_VERSION) RELEASE=$(RELEASE)
#
# Build final Oneclient Docker image with oneclient installed from
# self contained package (oneclient) into /opt/oneclient prefix and
# symlinked into /usr prefix.
#
docker_oneclient:
$(MAKE) -C oneclient docker PKG_VERSION=$(ONECLIENT_VERSION) RELEASE=$(RELEASE)
#
# Build self-contained Oneclient archive, by extracting all necessary files
# from intermediate Oneclient Docker image (oneclient-base)
#
oneclient_tar oneclient/$(ONECLIENT_FPMPACKAGE_TMP)/oneclient-bin.tar.gz:
$(MAKE) -C oneclient oneclient_tar
#
# Build production Oneclient RPM using FPM tool from self contained archive
#
oneclient_rpm: oneclient/$(ONECLIENT_FPMPACKAGE_TMP)/oneclient-bin.tar.gz rpmdirs
$(MAKE) -C oneclient DISTRIBUTION=$(DISTRIBUTION) ONECLIENT_VERSION=$(ONECLIENT_VERSION) \
oneclient_rpm
mv oneclient/$(ONECLIENT_FPMPACKAGE_TMP)/oneclient*.rpm package/$(DISTRIBUTION)/x86_64
#
# Build production Oneclient DEB using FPM tool from self-contained archive
#
oneclient_deb: oneclient/$(ONECLIENT_FPMPACKAGE_TMP)/oneclient-bin.tar.gz debdirs
$(MAKE) -C oneclient DISTRIBUTION=$(DISTRIBUTION) ONECLIENT_VERSION=$(ONECLIENT_VERSION) \
oneclient_deb
mv oneclient/$(ONECLIENT_FPMPACKAGE_TMP)/oneclient*.deb package/$(DISTRIBUTION)/binary-amd64