forked from portworx/torpedo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
108 lines (79 loc) · 2.47 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
TORPEDO_IMG=$(DOCKER_HUB_REPO)/$(DOCKER_HUB_TORPEDO_IMAGE):$(DOCKER_HUB_TAG)
.PHONY: vendor
ifndef TAGS
TAGS := daemon
endif
ifndef PKGS
PKGS := $(shell go list ./... 2>&1 | grep -v 'github.com/portworx/torpedo/vendor' | grep -v 'github.com/portworx/torpedo/tests')
endif
ifeq ($(BUILD_TYPE),debug)
BUILDFLAGS := -gcflags "-N -l"
endif
BASE_DIR := $(shell git rev-parse --show-toplevel)
BIN :=$(BASE_DIR)/bin
GOFMT := gofmt
GLIDEPATH := $(shell command -v glide 2> /dev/null)
.DEFAULT_GOAL=all
all: vet lint build fmt
deps:
GO15VENDOREXPERIMENT=0 go get -d -v $(PKGS)
update-deps:
GO15VENDOREXPERIMENT=0 go get -d -v -u -f $(PKGS)
test-deps:
GO15VENDOREXPERIMENT=0 go get -d -v -t $(PKGS)
update-test-deps:
GO15VENDOREXPERIMENT=0 go get -tags "$(TAGS)" -d -v -t -u -f $(PKGS)
fmt:
@echo -e "Performing gofmt on following: $(PKGS)"
@./scripts/do-gofmt.sh $(PKGS)
build:
mkdir -p $(BIN)
go build -tags "$(TAGS)" $(BUILDFLAGS) $(PKGS)
go get github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega
ginkgo build -r
find . -name '*.test' | awk '{cmd="cp "$$1" $(BIN)"; system(cmd)}'
chmod -R 755 bin/*
vendor:
ifndef GLIDEPATH
echo "Installing Glide"
curl https://glide.sh/get | sh
endif
glide update -v
# Workaround for https://github.com/sirupsen/logrus/issues/451, https://github.com/sirupsen/logrus/issues/543
find . -name '*.go' | grep -e vendor | xargs sed -i 's/Sirupsen/sirupsen/g'
install:
go install -tags "$(TAGS)" $(PKGS)
lint:
go get -v github.com/golang/lint/golint
for file in $$(find . -name '*.go' | grep -v vendor | grep -v '\.pb\.go' | grep -v '\.pb\.gw\.go'); do \
golint $${file}; \
if [ -n "$$(golint $${file})" ]; then \
exit 1; \
fi; \
done
vet:
go vet $(PKGS)
errcheck:
go get -v github.com/kisielk/errcheck
errcheck -tags "$(TAGS)" $(PKGS)
pretest: lint vet errcheck
test:
go test -tags "$(TAGS)" $(TESTFLAGS) $(PKGS)
container:
@echo "Building container: docker build --tag $(TORPEDO_IMG) -f Dockerfile ."
sudo docker build --tag $(TORPEDO_IMG) -f Dockerfile .
deploy: container
sudo docker push $(TORPEDO_IMG)
clean:
-sudo rm -rf bin
@echo "Deleting image "$(TORPEDO_IMG)
-docker rmi -f $(TORPEDO_IMG)
go clean -i $(PKGS)
DOCKER_HUB_SIDECAR_TAG=1.2.27
SIDECAR_WP_CLI_IMG=$(DOCKER_HUB_REPO)/wp-cli:$(DOCKER_HUB_SIDECAR_TAG)
SIDECAR_DIR=drivers/scheduler/sidecars
sidecar: sidecar-wp-cli
sidecar-wp-cli:
docker build -t $(SIDECAR_WP_CLI_IMG) -f $(SIDECAR_DIR)/wp-cli.dockerfile $(SIDECAR_DIR)
docker push $(SIDECAR_WP_CLI_IMG)