forked from nabla-containers/runnc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
138 lines (107 loc) · 3.99 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
# Copyright (c) 2018, IBM
# Author(s): Brandon Lum, Ricardo Koller, Dan Williams
#
# Permission to use, copy, modify, and/or distribute this software for
# any purpose with or without fee is hereby granted, provided that the
# above copyright notice and this permission notice appear in all
# copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
# OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
GO_BIN ?= go
ARCH=$(shell uname --m)
ifeq ($(ARCH), aarch64)
GOARCH="arm64"
else ifeq ($(ARCH), x86_64)
GOARCH="amd64"
endif
default: build
SUBMOD_NEEDS_UPDATE=$(shell [ -z "`git submodule | grep -v "^ "`" ] && echo 0 || echo 1)
ifeq ($(SUBMOD_NEEDS_UPDATE), 1)
submodule_warning:
$(info #####################################################)
$(info # Warning: git submodule out of date!!!! #)
$(info # Please run `git submodule update --init` #)
$(info #####################################################)
$(info )
$(info Continuing in 5 seconds...)
$(shell sleep 5)
else
submodule_warning:
endif
# Synced release version to download from
RELEASE_VER=v0.3
RELEASE_SERVER=https://github.com/nabla-containers/nabla-base-build/releases/download/${RELEASE_VER}/
build: submodule_warning godep build/runnc build/nabla-run test_images
container-build:
sudo docker build . -f Dockerfile.build -t runnc-build
sudo docker run --rm -v ${PWD}:/go/src/github.com/nabla-containers/runnc -w /go/src/github.com/nabla-containers/runnc runnc-build make
container-install:
sudo docker build . -f Dockerfile.build -t runnc-build
sudo docker run --rm -v /opt/runnc/:/opt/runnc/ -v /usr/local/bin:/usr/local/bin -v ${PWD}:/go/src/github.com/nabla-containers/runnc -w /go/src/github.com/nabla-containers/runnc runnc-build make install
container-uninstall:
sudo docker rmi -f runnc-build
make clean
sudo hack/update_binaries.sh delete
.PHONY: godep
ifeq ($(GO111MODULE),on)
godep:
$(GO_BIN) mod tidy
else
godep:
dep ensure
endif
update:
$(GO_BIN) get -u
build/runnc: godep runnc.go
GOOS=linux GOARCH=${GOARCH} $(GO_BIN) build -o $@ .
solo5/tenders/spt/solo5-spt: FORCE
make -C solo5
solo5/tests/test_hello/test_hello.spt: FORCE
make -C solo5
.PHONY: FORCE
build/nabla-run: solo5/tenders/spt/solo5-spt
install -m 775 -D $< $@
tests/integration/node.nabla:
wget -nc ${RELEASE_SERVER}/node-${ARCH}.nabla -O $@ && chmod +x $@
tests/integration/test_hello.nabla: solo5/tests/test_hello/test_hello.spt
install -m 664 -D $< $@
tests/integration/test_curl.nabla:
wget -nc ${RELEASE_SERVER}/test_curl-${ARCH}.nabla -O $@ && chmod +x $@
install: build/runnc build/nabla-run
sudo hack/update_binaries.sh
.PHONY: test,container-integration-test,local-integration-test,integration,integration-make
test: integration
test_images: \
tests/integration/node.nabla \
tests/integration/test_hello.nabla \
tests/integration/test_curl.nabla
integration: local-integration-test
integration-make:
make -C tests/integration
local-integration-test: integration-make
sudo tests/bats-core/bats -p tests/integration
#container-integration-test: test/integration/node_tests.iso
# sudo docker run -it --rm \
# -v $(CURDIR)/build:/build \
# -v $(CURDIR)/tests:/tests \
# --cap-add=NET_ADMIN \
# -e INCONTAINER=1 \
# ubuntu:16.04 /tests/bats-core/bats -p /tests/integration
clean:
sudo rm -rf build/
sudo rm -f tests/integration/node.nabla \
tests/integration/test_hello.nabla \
tests/integration/test_curl.nabla \
tests/integration/node_tests.iso
sudo make -C solo5 clean
SHELLCHECK=docker run --rm -v "$(CURDIR)":/v -w /v koalaman/shellcheck
.PHONY: shellcheck
shellcheck:
$(SHELLCHECK) tests/integration/*.bats tests/integration/*.bash