forked from openshift/machine-api-provider-openstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
97 lines (70 loc) · 1.89 KB
/
Makefile
File metadata and controls
97 lines (70 loc) · 1.89 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
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
TESTARGS_DEFAULT := "-v"
export TESTARGS ?= $(TESTARGS_DEFAULT)
HAS_LINT := $(shell command -v golint;)
GOOS ?= $(shell go env GOOS)
VERSION ?= $(shell git describe --exact-match 2> /dev/null || \
git describe --match=$(git rev-parse --short=8 HEAD) --always --dirty --abbrev=8)
GOFLAGS :=
TAGS :=
LDFLAGS := "-w -s -X 'main.version=${VERSION}'"
REGISTRY ?= k8scloudprovider
# CTI targets
build: manager
manager:
CGO_ENABLED=0 GOOS=$(GOOS) go build \
-ldflags $(LDFLAGS) \
-o bin/manager \
cmd/manager/main.go
test: ## Run tests
@echo -e "\033[32mTesting...\033[0m"
hack/ci-test.sh
check: fmt vet lint
unit:
go test -tags=unit $(shell go list ./...) $(TESTARGS)
.PHONY: check-vendor
check-vendor:
hack/verify-vendor.sh
fmt:
hack/verify-gofmt.sh
lint:
ifndef HAS_LINT
go get -u golang.org/x/lint/golint
echo "installing golint"
endif
hack/verify-golint.sh
vet:
go vet ./...
cover:
go test -tags=unit $(shell go list ./...) -cover
docs:
@echo "$@ not yet implemented"
godoc:
@echo "$@ not yet implemented"
releasenotes:
@echo "Reno not yet implemented for this repo"
translation:
@echo "$@ not yet implemented"
clean:
rm -rf _dist bin/manager
realclean: clean
rm -rf vendor
if [ "$(GOPATH)" = "$(GOPATH_DEFAULT)" ]; then \
rm -rf $(GOPATH); \
fi
images: openstack-cluster-api-controller
openstack-cluster-api-controller: manager
ifeq ($(GOOS),linux)
cp bin/manager cmd/manager
docker build -t $(REGISTRY)/openstack-cluster-api-controller:$(VERSION) cmd/manager
rm cmd/manager/manager
else
$(error Please set GOOS=linux for building the image)
endif
upload-images: images
@echo "push images to $(REGISTRY)"
docker login -u="$(DOCKER_USERNAME)" -p="$(DOCKER_PASSWORD)";
docker push $(REGISTRY)/openstack-cluster-api-controller:$(VERSION)
version:
@echo ${VERSION}
.PHONY: build clean cover docs fmt lint realclean \
test translation version unit