forked from tsuru/rpaas-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (39 loc) · 1.48 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
TAG=latest
IMAGE_OPERATOR=tsuru/rpaas-operator
IMAGE_API=tsuru/rpaas-api
KUBECONFIG ?= ~/.kube/config
git_tag := $(shell git describe --tags --abbrev=0 2>/dev/null || echo 'untagged')
git_commit := $(shell git rev-parse HEAD 2>/dev/null | cut -c1-7)
RPAAS_OPERATOR_VERSION ?= $(git_tag)/$(git_commit)
GO_LDFLAGS ?= -X=github.com/tsuru/rpaas-operator/version.Version=$(RPAAS_OPERATOR_VERSION)
.PHONY: test test/all test/integration deploy deploy/crds local build push build-api api build/plugin/rpaasv2
test/all: test test/integration
test:
go test -race ./... -cover
test/integration:
./scripts/localkube-integration.sh
lint:
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin $(GOLANGCI_LINT_VERSION)
go install ./...
golangci-lint run --config ./.golangci.yml ./...
deploy:
kubectl apply -R -f deploy/
deploy/crds:
kubectl apply -f deploy/crds/
local: deploy/crds
operator-sdk up local --go-ldflags $(GO_LDFLAGS)
generate:
operator-sdk generate k8s
build: build/plugin/rpaasv2
operator-sdk build $(IMAGE_OPERATOR):$(TAG) --go-build-args "-ldflags $(GO_LDFLAGS)"
docker build -t $(IMAGE_API):$(TAG) .
build/plugin/rpaasv2:
@mkdir -p build/_output/bin/
go build -ldflags $(GO_LDFLAGS) -o build/_output/bin/rpaasv2 ./cmd/plugin/rpaasv2
push: build
docker push $(IMAGE_OPERATOR):$(TAG)
docker push $(IMAGE_API):$(TAG)
build-api:
CGO_ENABLED=0 go build -o rpaas-api ./cmd/api
api: deploy/crds
go run ./cmd/api