forked from HYDPublic/ops-kube-db-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (56 loc) · 1.91 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
.PHONY: publish publish-version login test clean
REPO := myobplatform/ops-kube-db-operator
PKG_DIR = github.com/MYOB-Technology/ops-kube-db-operator/pkg
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
ci: vendor test
gen-mocks:
@docker-compose run --rm go generate ./...
test:
@docker-compose run --rm go test ./...
vendor:
docker-compose run --rm dep ensure -v
# Share in vendor directory to ensure libraries are available for local development
vendor-dev:
docker-compose run --rm dep-dev ensure -v
clean:
docker-compose run --rm base rm -rf vendor
ifdef DOCKERHUB_PASSWORD
login:
@docker login --username ${DOCKERHUB_USERNAME} --password ${DOCKERHUB_PASSWORD}
endif
publish: publish-version
docker build --build-arg VERSION=latest -t ${REPO}:latest .
docker push ${REPO}:latest
ifdef TRAVIS_TAG
publish-version:
docker build --build-arg VERSION=${TRAVIS_TAG} -t ${REPO}:${TRAVIS_TAG} .
docker push ${REPO}:${TRAVIS_TAG}
endif
gofmt:
@echo "+++ Formatting code with Gofmt"
@docker-compose run --rm gofmt -s -w ${GOFILES_NOVENDOR}
goimports:
@echo "+++ Checking imports with go imports"
@docker-compose run --rm goimports -e -l -w ${GOFILES_NOVENDOR}
lint:
@echo "+++ Running gometalinter"
@docker-compose run --rm gometalinter \
--sort path \
--skip=client --skip=apis --skip=signals --skip mocks \
--deadline 300s \
--vendor \
--enable-all \
--disable lll \
--disable test \
--disable testify \
./... --debug
run:
@echo "+++ Running outside cluster"
@docker-compose run --rm go run *.go -logtostderr=true -v=2
postgres-exporter-up:
@echo "Deploying exporter..."
@docker-compose run --rm gomplate --file=postgres-exporter.yaml --datasource config=values.yaml --datasource queries=queries.yaml -o output.yaml
@docker-compose run --rm kubectl apply -f output.yaml
postgres-exporter-down:
@echo "Destroying exporter..."
@docker-compose run --rm kubectl delete -f output.yaml