forked from metal-stack/csi-lvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (40 loc) · 2.1 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
GO111MODULE := on
DOCKER_TAG := $(or ${GITHUB_TAG_NAME}, latest)
all: provisioner controller
.PHONY: provisioner
provisioner:
go build -tags netgo -o bin/csi-lvm-provisioner cmd/provisioner/*.go
strip bin/csi-lvm-provisioner
.PHONY: controller
controller:
go build -tags netgo -o bin/csi-lvm-controller cmd/controller/*.go
strip bin/csi-lvm-controller
.PHONY: dockerimages
dockerimages:
docker build -t metalstack/csi-lvm-provisioner:${DOCKER_TAG} . -f cmd/provisioner/Dockerfile
docker build -t metalstack/csi-lvm-controller:${DOCKER_TAG} . -f cmd/controller/Dockerfile
.PHONY: dockerpush
dockerpush:
docker push metalstack/csi-lvm-controller:${DOCKER_TAG}
docker push metalstack/csi-lvm-provisioner:${DOCKER_TAG}
.PHONY: clean
clean:
rm -f bin/*
.PHONY: tests
tests:
@if minikube status >/dev/null 2>/dev/null; then echo "a minikube is already running. Exiting ..."; exit 1; fi
@echo "Starting minikube testing setup ... please wait ..."
@./deploy/start-minikube-on-linux.sh >/dev/null 2>/dev/null
@kubectl config view --flatten --minify > tests/files/.kubeconfig
@minikube docker-env > tests/files/.dockerenv
@sh -c '. ./tests/files/.dockerenv && docker build -t metalstack/csi-lvm-provisioner:${DOCKER_TAG} . -f cmd/provisioner/Dockerfile'
@sh -c '. ./tests/files/.dockerenv && docker build -t metalstack/csi-lvm-controller:${DOCKER_TAG} . -f cmd/controller/Dockerfile'
@sh -c '. ./tests/files/.dockerenv && docker build -t csi-lvm-tests:${DOCKER_TAG} --build-arg prtag=${DOCKER_TAG} --build-arg prpullpolicy="IfNotPresent" --build-arg prdevicepattern="loop[0-1]" tests' >/dev/null
@sh -c '. ./tests/files/.dockerenv && docker run --rm csi-lvm-tests:${DOCKER_TAG} bats /bats/start.bats /bats/revive.bats /bats/end.bats'
@rm tests/files/.dockerenv
@rm tests/files/.kubeconfig
@minikube delete
.PHONY: metalci
metalci: dockerimages dockerpush
docker build -t csi-lvm-tests:${DOCKER_TAG} --build-arg prtag=${DOCKER_TAG} --build-arg prpullpolicy="Always" --build-arg prdevicepattern='nvme[0-9]n[0-9]' tests > /dev/null
docker run --rm csi-lvm-tests:${DOCKER_TAG} bats /bats/start.bats /bats/cycle.bats /bats/end.bats