-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
213 lines (163 loc) · 5.82 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
# Makefile for building Chaos CI LIB
# Reference Guide - https://www.gnu.org/software/make/manual/make.html
IS_DOCKER_INSTALLED = $(shell which docker >> /dev/null 2>&1; echo $$?)
# list only our namespaced directories
PACKAGES = $(shell go list ./... | grep -v '/vendor/')
# docker info
DOCKER_REPO ?= litmuschaos
DOCKER_IMAGE ?= chaos-ci-lib
DOCKER_TAG ?= ci
.PHONY: all
all: format lint deps build test trivy-check push
.PHONY: help
help:
@echo ""
@echo "Usage:-"
@echo "\tmake all -- [default] builds the chaos exporter container"
@echo ""
.PHONY: format
format:
@echo "------------------"
@echo "--> Running go fmt"
@echo "------------------"
@go fmt $(PACKAGES)
.PHONY: lint
lint:
@echo "------------------"
@echo "--> Running golint"
@echo "------------------"
@golint $(PACKAGES)
@echo "------------------"
@echo "--> Running go vet"
@echo "------------------"
@go vet $(PACKAGES)
.PHONY: deps
deps: _build_check_docker godeps
_build_check_docker:
@if [ $(IS_DOCKER_INSTALLED) -eq 1 ]; \
then echo "" \
&& echo "ERROR:\tdocker is not installed. Please install it before build." \
&& echo "" \
&& exit 1; \
fi;
godeps:
@echo "INFO:\tverifying dependencies for chaos-ci-lib build ..."
@go get -u -v golang.org/x/lint/golint
@go get -u -v golang.org/x/tools/cmd/goimports
PHONY: build
build: go-binary-build docker-build
PHONY: go-binary-build
go-binary-build:
@echo "---------------------------"
@echo "--> Building Go Test Binary"
@echo "---------------------------"
@sh build/generate_go_binary
docker-build:
@echo "----------------------------"
@echo "--> Build chaos-ci-lib image"
@echo "----------------------------"
@docker build . -f build/Dockerfile -t $(DOCKER_REPO)/$(DOCKER_IMAGE):$(DOCKER_TAG)
.PHONY: push
push: docker-push
docker-push:
@echo "---------------------------"
@echo "--> Push chaos-ci-lib image"
@echo "---------------------------"
@docker push $(DOCKER_REPO)/$(DOCKER_IMAGE):$(DOCKER_TAG)
.PHONY: trivy-check
trivy-check:
@echo "------------------------"
@echo "---> Running Trivy Check"
@echo "------------------------"
@./trivy --exit-code 0 --severity HIGH --no-progress $(DOCKER_REPO)/$(DOCKER_IMAGE):$(DOCKER_TAG)
@./trivy --exit-code 0 --severity CRITICAL --no-progress $(DOCKER_REPO)/$(DOCKER_IMAGE):$(DOCKER_TAG)
.PHONY: install
install:
@echo "--------------------------------------"
@echo "---> Installing LitmusChaos"
@echo "--------------------------------------"
@go test litmus/install-litmus_test.go -v -count=1
.PHONY: uninstall
uninstall:
@echo "--------------------------------------"
@echo "---> Uninstalling LitmusChaos"
@echo "--------------------------------------"
@go test litmus/uninstall-litmus_test.go -v -count=1
.PHONY: container-kill
container-kill:
@echo "--------------------------------------"
@echo "---> Running Container Kill Experiment"
@echo "--------------------------------------"
@go test experiments/container-kill_test.go -v -count=1
.PHONY: disk-fill
disk-fill:
@echo "--------------------------------------"
@echo "---> Running Disk Fill Experiment"
@echo "--------------------------------------"
@go test experiments/disk-fill_test.go -v -count=1
.PHONY: node-cpu-hog
node-cpu-hog:
@echo "--------------------------------------"
@echo "---> Running Node CPU Hog Experiment"
@echo "--------------------------------------"
@go test experiments/node-cpu-hog_test.go -v -count=1
.PHONY: node-io-stress
node-io-stress:
@echo "--------------------------------------"
@echo "---> Running Node IO Stess Experiment"
@echo "--------------------------------------"
@go test experiments/node-io-stress_test.go -v -count=1
.PHONY: node-memory-hog
node-memory-hog:
@echo "--------------------------------------"
@echo "---> Running Node Memory Hog Experiment"
@echo "--------------------------------------"
@go test experiments/node-memory-hog_test.go -v -count=1
.PHONY: pod-autoscaler
pod-autoscaler:
@echo "--------------------------------------"
@echo "---> Running Pod Autoscaler Experiment"
@echo "--------------------------------------"
@go test experiments/pod-autoscaler_test.go -v -count=1
.PHONY: pod-cpu-hog
pod-cpu-hog:
@echo "--------------------------------------"
@echo "---> Running Pod CPU Hog Experiment"
@echo "--------------------------------------"
@go test experiments/pod-cpu-hog_test.go -v -count=1
.PHONY: pod-delete
pod-delete:
@echo "--------------------------------------"
@echo "---> Running Pod Delete Experiment"
@echo "--------------------------------------"
@go test experiments/pod-delete_test.go -v -count=1
.PHONY: pod-memory-hog
pod-memory-hog:
@echo "--------------------------------------"
@echo "---> Running Pod Memory Hog Experiment"
@echo "--------------------------------------"
@go test experiments/pod-memory-hog_test.go -v -count=1
.PHONY: pod-network-corruption
pod-network-corruption:
@echo "--------------------------------------"
@echo "---> Running Pod Network Corruption Experiment"
@echo "--------------------------------------"
@go test experiments/pod-network-corruption_test.go -v -count=1
.PHONY: pod-network-duplication
pod-network-duplication:
@echo "--------------------------------------"
@echo "---> Running Pod Network Duplication Experiment"
@echo "--------------------------------------"
@go test experiments/pod-network-duplication_test.go -v -count=1
.PHONY: pod-network-latency
pod-network-latency:
@echo "--------------------------------------"
@echo "---> Running Pod Network Latency Experiment"
@echo "--------------------------------------"
@go test experiments/pod-network-latency_test.go -v -count=1
.PHONY: pod-network-loss
pod-network-loss:
@echo "--------------------------------------"
@echo "---> Running Pod Network Loss Experiment"
@echo "--------------------------------------"
@go test experiments/pod-network-loss_test.go -v -count=1