forked from dell/csi-baremetal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.validation
179 lines (145 loc) · 8.23 KB
/
Makefile.validation
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
include variables.mk
### Lint
lint:
${GO_ENV_VARS} golangci-lint -v run ./...
### Unit tests
coverage:
go tool cover -html=coverage.out -o coverage.html
test:
${GO_ENV_VARS} go test `go list ./... | grep -v halmgr | grep pkg` -race -cover -coverprofile=coverage.out -covermode=atomic
# Run tests for pr-validation with writing output to log file
# Test are different (ginkgo, go testing, etc.) so can't use native ginkgo methods to print junit output.
test-pr-validation:
${GO_ENV_VARS} go test `go list ./... | grep -v halmgr` -v -race -cover -coverprofile=coverage.out > log.txt
install-junit-report:
${GO_ENV_VARS} go get -u github.com/jstemmer/go-junit-report
# Convert go test output from log.txt to junit-style output. Split these steps because no matter if test fails,
# junit output must be collected
pr-validation-junit:
cat log.txt >&1 | go-junit-report > report.xml
### E2E
# Run e2e tests for CI. All of these tests use ginkgo so we can use native ginkgo methods to print junit output.
# Also go test doesn't provide functionnality to save test's log into the file. Use > to archieve artifatcs.
test-ci:
${GO_ENV_VARS} CI=true CSI_VERSION=${CSI_VERSION} OPERATOR_VERSION=${OPERATOR_VERSION} go test -v test/e2e/baremetal_e2e_test.go -ginkgo.v -ginkgo.progress -all-tests -kubeconfig=${HOME}/.kube/config -chartsDir ${CHARTS_DIR} -timeout 0 > log.txt
# Run e2e tests and run community tests only.
test-short-ci:
${GO_ENV_VARS} CI=true CSI_VERSION=${CSI_VERSION} OPERATOR_VERSION=${OPERATOR_VERSION} go test -v test/e2e/baremetal_e2e_test.go -ginkgo.v -ginkgo.progress -ginkgo.failFast -timeout-short-ci=${SHORT_CI_TIMEOUT} -kubeconfig=${HOME}/.kube/config -chartsDir ${CHARTS_DIR} -timeout 0 > log.txt
# Run commnity sanity tests for CSI. TODO https://github.com/dell/csi-baremetal/issues/298 Make sanity test work for expansion
# TODO enable tests back - https://github.com/dell/csi-baremetal/issues/371
test-sanity:
# ${GO_ENV_VARS} SANITY=true go test test/sanity/sanity_test.go -ginkgo.skip \
# "ExpandVolume|\
# ValidateVolumeCapabilities|\
# should fail when the node does not exist|\
# should fail when requesting to create a volume with already existing name and different capacity|\
# should not fail when requesting to create a volume with already existing name and same capacity" -ginkgo.v -timeout=0
load-operator-image: pull-operator-image \
kind-tag-operator-image \
kind-load-operator-image
pull-operator-image:
docker pull ${REGISTRY}/${PROJECT}-${OPERATOR}:${OPERATOR_VERSION}
kind-tag-operator-image:
docker tag ${REGISTRY}/${PROJECT}-${OPERATOR}:${OPERATOR_VERSION} ${PROJECT}-${OPERATOR}:${OPERATOR_VERSION}
kind-load-operator-image:
$(KIND) load docker-image ${PROJECT}-${OPERATOR}:${OPERATOR_VERSION}
kind-pull-images: kind-pull-sidecar-images
docker pull ${REGISTRY}/${PROJECT}-${LOOPBACK_DRIVE_MGR}:${TAG}
docker pull ${REGISTRY}/${PROJECT}-${NODE}:${TAG}
docker pull ${REGISTRY}/${PROJECT}-${NODE}-kernel-5.4:${TAG}
docker pull ${REGISTRY}/${PROJECT}-${CONTROLLER}:${TAG}
docker pull ${REGISTRY}/${PROJECT}-${SCHEDULER}-${EXTENDER}:${TAG}
docker pull ${REGISTRY}/${PROJECT}-${EXTENDER_PATCHER}:${TAG}
docker pull ${REGISTRY}/${PROJECT}-${SCHEDULER}:${TAG}
docker pull ${REGISTRY}/${PROJECT}-${NODE_CONTROLLER}:${TAG}
kind-pull-sidecar-images:
docker pull ${REGISTRY}/${CSI_PROVISIONER}:${CSI_PROVISIONER_TAG}
docker pull ${REGISTRY}/${CSI_REGISTRAR}:${CSI_REGISTRAR_TAG}
docker pull ${REGISTRY}/${LIVENESS_PROBE}:${LIVENESS_PROBE_TAG}
docker pull ${REGISTRY}/${CSI_RESIZER}:${CSI_RESIZER_TAG}
docker pull ${REGISTRY}/${BUSYBOX}:${BUSYBOX_TAG}
docker pull ${REGISTRY}/library/nginx:1.14-alpine
docker pull ${REGISTRY}/library/centos:latest
kind-tag-images:
docker tag ${REGISTRY}/${CSI_PROVISIONER}:${CSI_PROVISIONER_TAG} ${CSI_PROVISIONER}:${CSI_PROVISIONER_TAG}
docker tag ${REGISTRY}/${CSI_REGISTRAR}:${CSI_REGISTRAR_TAG} ${CSI_REGISTRAR}:${CSI_REGISTRAR_TAG}
docker tag ${REGISTRY}/${CSI_RESIZER}:${CSI_RESIZER_TAG} ${CSI_RESIZER}:${CSI_RESIZER_TAG}
docker tag ${REGISTRY}/${LIVENESS_PROBE}:${LIVENESS_PROBE_TAG} ${LIVENESS_PROBE}:${LIVENESS_PROBE_TAG}
docker tag ${REGISTRY}/${BUSYBOX}:${BUSYBOX_TAG} ${BUSYBOX}:${BUSYBOX_TAG}
docker tag ${REGISTRY}/library/nginx:1.14-alpine docker.io/library/nginx:1.14-alpine
docker tag ${REGISTRY}/library/centos:latest docker.io/library/centos:latest
docker tag ${REGISTRY}/${PROJECT}-${LOOPBACK_DRIVE_MGR}:${TAG} ${PROJECT}-${LOOPBACK_DRIVE_MGR}:${TAG}
docker tag ${REGISTRY}/${PROJECT}-${NODE}:${TAG} ${PROJECT}-${NODE}:${TAG}
docker tag ${REGISTRY}/${PROJECT}-${NODE}-kernel-5.4:${TAG} ${PROJECT}-${NODE}-kernel-5.4:${TAG}
docker tag ${REGISTRY}/${PROJECT}-${CONTROLLER}:${TAG} ${PROJECT}-${CONTROLLER}:${TAG}
docker tag ${REGISTRY}/${PROJECT}-${SCHEDULER}-${EXTENDER}:${TAG} ${PROJECT}-${SCHEDULER}-${EXTENDER}:${TAG}
docker tag ${REGISTRY}/${PROJECT}-${EXTENDER_PATCHER}:${TAG} ${PROJECT}-${EXTENDER_PATCHER}:${TAG}
docker tag ${REGISTRY}/${PROJECT}-${SCHEDULER}:${TAG} ${PROJECT}-${SCHEDULER}:${TAG}
docker tag ${REGISTRY}/${PROJECT}-${NODE_CONTROLLER}:${TAG} ${PROJECT}-${NODE_CONTROLLER}:${TAG}
kind-load-images:
$(KIND) load docker-image ${CSI_PROVISIONER}:${CSI_PROVISIONER_TAG}
$(KIND) load docker-image ${CSI_REGISTRAR}:${CSI_REGISTRAR_TAG}
$(KIND) load docker-image ${CSI_RESIZER}:${CSI_RESIZER_TAG}
$(KIND) load docker-image ${LIVENESS_PROBE}:${LIVENESS_PROBE_TAG}
$(KIND) load docker-image ${BUSYBOX}:${BUSYBOX_TAG}
$(KIND) load docker-image docker.io/library/nginx:1.14-alpine
$(KIND) load docker-image docker.io/library/centos:latest
$(KIND) load docker-image ${PROJECT}-${LOOPBACK_DRIVE_MGR}:${TAG}
$(KIND) load docker-image ${PROJECT}-${NODE}:${TAG}
$(KIND) load docker-image ${PROJECT}-${NODE}-kernel-5.4:${TAG}
$(KIND) load docker-image ${PROJECT}-${CONTROLLER}:${TAG}
$(KIND) load docker-image ${PROJECT}-${SCHEDULER}-${EXTENDER}:${TAG}
$(KIND) load docker-image ${PROJECT}-${EXTENDER_PATCHER}:${TAG}
$(KIND) load docker-image ${PROJECT}-${SCHEDULER}:${TAG}
$(KIND) load docker-image ${PROJECT}-${NODE_CONTROLLER}:${TAG}
kind-build:
# Get kind sources
wget -O kind-src https://codeload.github.com/kubernetes-sigs/kind/tar.gz/refs/tags/v$(KIND_VER)
tar -xzvf kind-src
# Add "--ipc=host" docker option and build binary
patch -p0 < $(KIND_DIR)/kind-$(KIND_VER).patch
cd kind-$(KIND_VER) && make build
# Copy file
cp kind-$(KIND_VER)/bin/kind $(KIND_DIR)
# Make executive
chmod +x $(KIND)
# Check
$(KIND) version
# Clean workdir
rm -rf kind-$(KIND_VER)
rm -f kind-src
kind-install: kind-build
# Delete actual
rm -f /usr/bin/kind
# Copy executive file
mv $(KIND) /usr/bin
# Check
kind version
kind-create-cluster:
$(KIND) create cluster --config $(KIND_DIR)/$(KIND_CONFIG) --image kindest/node:$(KIND_IMAGE_VERSION) --wait $(KIND_WAIT)
kind-delete-cluster:
$(KIND) delete cluster
deps-docker-pull:
docker pull k8s.gcr.io/sig-storage/${CSI_PROVISIONER}:${CSI_PROVISIONER_TAG}
docker pull quay.io/k8scsi/${CSI_REGISTRAR}:${CSI_REGISTRAR_TAG}
docker pull k8s.gcr.io/sig-storage/${LIVENESS_PROBE}:${LIVENESS_PROBE_TAG}
docker pull k8s.gcr.io/sig-storage/${CSI_RESIZER}:${CSI_RESIZER_TAG}
docker pull ${BUSYBOX}:${BUSYBOX_TAG}
docker pull nginx:1.14-alpine
docker pull centos:latest
deps-docker-tag:
docker tag k8s.gcr.io/sig-storage/${CSI_PROVISIONER}:${CSI_PROVISIONER_TAG} ${REGISTRY}/${CSI_PROVISIONER}:${CSI_PROVISIONER_TAG}
docker tag quay.io/k8scsi/${CSI_REGISTRAR}:${CSI_REGISTRAR_TAG} ${REGISTRY}/${CSI_REGISTRAR}:${CSI_REGISTRAR_TAG}
docker tag k8s.gcr.io/sig-storage/${LIVENESS_PROBE}:${LIVENESS_PROBE_TAG} ${REGISTRY}/${LIVENESS_PROBE}:${LIVENESS_PROBE_TAG}
docker tag k8s.gcr.io/sig-storage/${CSI_RESIZER}:${CSI_RESIZER_TAG} ${REGISTRY}/${CSI_RESIZER}:${CSI_RESIZER_TAG}
docker tag ${BUSYBOX}:${BUSYBOX_TAG} ${REGISTRY}/${BUSYBOX}:${BUSYBOX_TAG}
docker tag nginx:1.14-alpine ${REGISTRY}/library/nginx:1.14-alpine
docker tag centos:latest ${REGISTRY}/library/centos:latest
deps-docker-push:
docker push ${REGISTRY}/${CSI_PROVISIONER}:${CSI_PROVISIONER_TAG}
docker push ${REGISTRY}/${CSI_REGISTRAR}:${CSI_REGISTRAR_TAG}
docker push ${REGISTRY}/${LIVENESS_PROBE}:${LIVENESS_PROBE_TAG}
docker push ${REGISTRY}/${CSI_RESIZER}:${CSI_RESIZER_TAG}
docker push ${REGISTRY}/${BUSYBOX}:${BUSYBOX_TAG}
docker push ${REGISTRY}/library/nginx:1.14-alpine
docker push ${REGISTRY}/library/centos:latest