This repository is currently being migrated. It's locked while the migration is in progress.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (57 loc) · 1.43 KB
/
Makefile
File metadata and controls
72 lines (57 loc) · 1.43 KB
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
IMAGE ?= storageos/init:test
GO_BUILD_CMD = go build -v
GO_ENV = GOOS=linux CGO_ENABLED=0
# Test node image name.
NODE_IMAGE ?= storageos/node:1.4.0
# Test scripts path.
SCRIPTS_PATH ?= /scripts
all: test build
.PHONY: build
build:
@echo "Building init"
$(GO_ENV) $(GO_BUILD_CMD) -o ./build/_output/bin/init .
tidy:
go mod tidy -v
go mod vendor -v
# Build the docker image
docker-build:
docker build --no-cache . -f Dockerfile -t $(IMAGE)
# Push the docker image
docker-push:
docker push ${IMAGE}
# Run tests
test: generate fmt vet
go test -v -race `go list -v ./...`
# Run go fmt against code
fmt:
go fmt ./...
# Run go vet against code
vet:
go vet ./...
clean:
rm -rf build/_output
# Run the init scripts on the host.
run:
docker run --rm \
--cap-add=SYS_ADMIN \
--privileged \
-v /lib/modules:/lib/modules \
-v /var/lib/storageos:/var/lib/storageos:rshared \
-v /sys:/sys:rshared \
storageos/init:test \
/init -scripts=$(SCRIPTS_PATH) -nodeImage=$(NODE_IMAGE)
# Generate mocks.
generate: mockgen
@PATH=$$(go env GOPATH)/bin:$(PATH); \
go generate ./...
# Install mockgen dependency.
mockgen:
@PATH=$$(go env GOPATH)/bin:$(PATH); \
if ! which mockgen 1>/dev/null; then \
go get github.com/golang/mock/gomock; \
go get github.com/golang/mock/mockgen; \
fi
# Prepare the repo for a new release. Run:
# NEW_VERSION=<version> make release
release:
sed -i -e "s/version=.*/version=\"$(NEW_VERSION)\" \\\/g" Dockerfile