forked from projectcalico/netmodules-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (49 loc) · 2.05 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
.PHONEY: binary
SRCDIR=calico_mesos
BUILD_DIR=build_calico_mesos
PYCALICO=$(wildcard $(BUILD_DIR)/libcalico/calico_containers/pycalico/*.py)
CALICO_MESOS=$(wildcard $(SRCDIR)/calico_mesos.py)
ST_TO_RUN?=calico_mesos/tests/st/
binary: dist/calico_isolator
# Create the image that builds calico_isolator
calico_mesos_builder.created: $(BUILD_DIR) $(PYCALICO)
cd build_calico_mesos; docker build -t calico/mesos-builder .
touch calico_mesos_builder.created
# Create the binary: check code changes to source code, ensure builder is created.
dist/calico_isolator: $(CALICO_MESOS) calico_mesos_builder.created
mkdir -p dist
chmod 777 `pwd`/dist
# Build the mesos plugin
docker run \
-u user \
-v `pwd`/calico_mesos:/code/calico_mesos \
-v `pwd`/dist:/code/dist \
-e PYTHONPATH=/code/calico_mesos \
calico/mesos-builder pyinstaller calico_mesos/calico_mesos.py -a -F -s --clean
st: dist/calico_isolator
nosetests $(ST_TO_RUN) --with-timer
run-etcd:
@-docker rm -f mesos-etcd
docker run --detach \
--net=host \
--name mesos-etcd quay.io/coreos/etcd:v2.0.11 \
--advertise-client-urls "http://$(LOCAL_IP_ENV):2379,http://127.0.0.1:4001" \
--listen-client-urls "http://0.0.0.0:2379,http://0.0.0.0:4001"
ut: calico_mesos_builder.created
# Use the `root` user, since code coverage requires the /code directory to
# be writable. It may not be writable for the `user` account inside the
# container.
docker run --rm -v `pwd`/calico_mesos:/code -u root \
calico/mesos-builder bash -c \
'/tmp/etcd -data-dir=/tmp/default.etcd/ >/dev/null 2>&1 & \
nosetests tests/unit -c nose.cfg'
ut-circle: calico_mesos_builder.created dist/calico_isolator
docker run \
-v `pwd`/calico_mesos:/code \
-v $(CIRCLE_TEST_REPORTS):/circle_output \
-e COVERALLS_REPO_TOKEN=$(COVERALLS_REPO_TOKEN) \
calico/mesos-builder bash -c \
'/tmp/etcd -data-dir=/tmp/default.etcd/ >/dev/null 2>&1 & \
cd calico_containers; nosetests tests/unit -c nose.cfg \
--with-xunit --xunit-file=/circle_output/output.xml; RC=$$?;\
[[ ! -z "$$COVERALLS_REPO_TOKEN" ]] && coveralls || true; exit $$RC'