This repository has been archived by the owner on Apr 28, 2022. It is now read-only.
forked from trickstercache/trickster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (69 loc) · 2.67 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
DEFAULT: build
GO ?= go
GOFMT ?= $(GO)fmt
FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
DEP := $(FIRST_GOPATH)/bin/dep
TRICKSTER := $(FIRST_GOPATH)/bin/trickster
PROGVER = $(shell grep 'applicationVersion = ' main.go | awk '{print $$3}' | sed -e 's/\"//g')
.PHONY: go-mod-vendor
go-mod-vendor:
GO111MODULE=on $(GO) mod vendor
.PHONY: build
build: go-mod-vendor
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=$(CGO_ENABLED) go build -a -v
rpm: build
mkdir -p ./OPATH/SOURCES
cp -p trickster ./OPATH/SOURCES/
cp conf/trickster.service ./OPATH/SOURCES/
sed -e 's%^# log_file =.*$$%log_file = "/var/log/trickster/trickster.log"%' \
-e 's%prometheus:9090%localhost:9090%' \
< conf/example.conf > ./OPATH/SOURCES/trickster.conf
rpmbuild --define "_topdir $(CURDIR)/OPATH" \
--define "_version $(PROGVER)" \
--define "_release 1" \
-ba deploy/packaging/trickster.spec
.PHONY: install
install: go-mod-vendor
echo go build -o $(TRICKSTER) $(PROGVER)
.PHONY: release
release: build release-artifacts docker docker-release
.PHONY: release-artifacts
release-artifacts:
GOOS=darwin GOARCH=amd64 go build -o ./OPATH/trickster-$(PROGVER).darwin-amd64 && gzip -f ./OPATH/trickster-$(PROGVER).darwin-amd64
GOOS=linux GOARCH=amd64 go build -o ./OPATH/trickster-$(PROGVER).linux-amd64 && gzip -f ./OPATH/trickster-$(PROGVER).linux-amd64
.PHONY: helm-local
helm-local:
kubectl config use-context minikube --namespace=trickster
kubectl scale --replicas=0 deployment/dev-trickster -n trickster
eval $$(minikube docker-env) \
&& docker build -f deploy/Dockerfile -t trickster:dev .
kubectl set image deployment/dev-trickster trickster=trickster:dev -n trickster
kubectl scale --replicas=1 deployment/dev-trickster -n trickster
.PHONY: kube-local
kube-local:
kubectl config use-context minikube
kubectl scale --replicas=0 deployment/trickster
eval $$(minikube docker-env) \
&& docker build -f deploy/Dockerfile -t trickster:dev .
kubectl set image deployment/trickster trickster=trickster:dev
kubectl scale --replicas=1 deployment/trickster
.PHONY: docker
docker:
docker build -f ./deploy/Dockerfile -t trickster:$(PROGVER) .
.PHONY: docker-release
docker-release:
docker tag trickster:$(PROGVER) tricksterio/trickster:$(PROGVER)
docker tag tricksterio/trickster:$(PROGVER) tricksterio/trickster:latest
.PHONY: style
style:
! gofmt -d $$(find . -path ./vendor -prune -o -name '*.go' -print) | grep '^'
.PHONY: test
test: go-mod-vendor
go test -o $(TRICKSTER) -v ./...
.PHONY: test-cover
test-cover: go-mod-vendor
go test -o $(TRICKSTER) -coverprofile=cover.out ./...
go tool cover -html=cover.out
.PHONY: clean
clean:
rm -rf ./trickster ./OPATH ./vendor