forked from cilium/cilium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
108 lines (90 loc) · 3.18 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
include Makefile.defs
SUBDIRS = plugins bpf cilium daemon
GOFILES = $(shell go list ./... | grep -v /vendor/)
GOLANGVERSION = $(shell go version 2>/dev/null | grep -Eo '(go[0-9].[0-9])')
all: $(SUBDIRS)
$(SUBDIRS): force
@ $(MAKE) -C $@ all
tests: tests-common tests-consul
tests-common: force
tests/00-fmt.sh
go vet $(GOFILES)
tests-etcd:
@docker rm -f "cilium-etcd-test-container" 2> /dev/null || true
-docker run -d \
--name "cilium-etcd-test-container" \
-p 4002:4001 \
quay.io/coreos/etcd:v3.1.0-rc.0 \
etcd -name etcd0 \
-advertise-client-urls http://0.0.0.0:4001 \
-listen-client-urls http://0.0.0.0:4001 \
-initial-cluster-token etcd-cluster-1 \
-initial-cluster-state new
echo "mode: count" > coverage-all.out
echo "mode: count" > coverage.out
$(foreach pkg,$(GOFILES),\
go test \
-ldflags "-X "github.com/cilium/cilium/daemon".kvBackend=etcd" \
-timeout 30s -coverprofile=coverage.out -covermode=count $(pkg) || exit 1;\
tail -n +2 coverage.out >> coverage-all.out;)
go tool cover -html=coverage-all.out -o=coverage-all.html
rm coverage-all.out
rm coverage.out
@rmdir ./daemon/1 ./daemon/1_backup 2> /dev/null || true
docker rm -f "cilium-etcd-test-container"
tests-consul:
@docker rm -f "cilium-consul-test-container" 2> /dev/null || true
-docker run -d \
--name "cilium-consul-test-container" \
-p 8501:8500 \
-e 'CONSUL_LOCAL_CONFIG={"skip_leave_on_interrupt": true}' \
consul:0.8.3 \
agent -client=0.0.0.0 -server -bootstrap-expect 1
echo "mode: count" > coverage-all.out
echo "mode: count" > coverage.out
$(foreach pkg,$(GOFILES),\
go test \
-ldflags "-X "github.com/cilium/cilium/daemon".kvBackend=consul" \
-timeout 30s -coverprofile=coverage.out -covermode=count $(pkg) || exit 1;\
tail -n +2 coverage.out >> coverage-all.out;)
go tool cover -html=coverage-all.out -o=coverage-all.html
rm coverage-all.out
rm coverage.out
@rmdir ./daemon/1 ./daemon/1_backup 2> /dev/null || true
docker rm -f "cilium-consul-test-container"
clean:
for i in $(SUBDIRS); do $(MAKE) -C $$i clean; done
for i in $(SUBDIRSLIB); do $(MAKE) -C $$i clean; done
-$(MAKE) -C ./contrib/packaging/deb clean
-$(MAKE) -C ./contrib/packaging/rpm clean
-$(MAKE) -C ./contrib/packaging/docker clean
install:
$(INSTALL) -m 0755 -d $(DESTDIR)$(BINDIR)
for i in $(SUBDIRS); do $(MAKE) -C $$i install; done
for i in $(SUBDIRSLIB); do $(MAKE) -C $$i install; done
docker-image:
$(MAKE) -C ./contrib/packaging/docker
build-deb:
$(MAKE) -C ./contrib/packaging/deb
build-rpm:
$(MAKE) -C ./contrib/packaging/rpm
runtime-tests:
$(MAKE) -C tests runtime-tests
k8s-tests:
$(MAKE) -C tests k8s-tests
generate-api:
swagger generate server -t api/v1 -f api/v1/openapi.yaml -a restapi \
-s server --default-scheme=unix -C api/v1/cilium-server.yml
swagger generate client -t api/v1 -f api/v1/openapi.yaml -a restapi
vps:
VBoxManage list runningvms
reload:
cd daemon && make go-bindata
make
sudo systemctl stop cilium cilium-docker
sudo make install
sudo systemctl start cilium cilium-docker
sleep 6
cilium status
.PHONY: force
force :;