-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
103 lines (80 loc) · 2.64 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
# Image URL to use all building/pushing image targets
IMG ?= cloudoperators/event-streams-topic
GOFILES = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
deps:
go get golang.org/x/lint/golint
go get -u github.com/apg/patter
go get -u github.com/wadey/gocovmerge
go get -u github.com/alecthomas/gometalinter
gometalinter --install
pip install --user PyYAML
all: test manager
# Run tests
test: generate fmt vet manifests
go test ./pkg/... ./cmd/... -coverprofile cover.out
# Build manager binary
manager: generate fmt vet
go build -o bin/manager github.com/ibm/event-streams-topic/cmd/manager
# Run against the configured Kubernetes cluster in ~/.kube/config
run: generate fmt vet
go run ./cmd/manager/main.go
# Install CRDs into a cluster
install: manifests
kubectl apply -f config/crds
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
deploy: manifests
kubectl apply -f config/crds
kustomize build config/default | kubectl apply -f -
# Generate manifests e.g. CRD, RBAC etc.
manifests:
go run vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go all
hack/crd-fix.sh
# Run go fmt against code
fmt:
go fmt ./pkg/... ./cmd/...
# Run go vet against code
vet:
go vet ./pkg/... ./cmd/...
# Generate code
generate:
go generate ./pkg/... ./cmd/...
# Build the docker image
docker-build: check-tag
git rev-parse --short HEAD > git-rev
docker build . -t ${IMG}:${TAG}
rm git-rev
@echo "updating kustomize image patch file for manager resource"
sed -i'' -e 's@image: .*@image: '"${IMG}:${TAG}"'@' ./config/default/manager_image_patch.yaml
# Push the docker image
docker-push: check-tag
echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
docker push ${IMG}:${TAG}
# Run the operator-sdk scorecard on latest release
scorecard:
hack/operator-scorecard.sh
# make a release for olm and releases
release: check-tag
python hack/package.py v${TAG}
# make update release for olm and releases
release-update: check-tag
python hack/package.py v${TAG} --is_update
# Push OLM metadata to private Quay registry
push-olm: check-tag check-quaytoken check-quayns
operator-courier push olm/v${TAG} ${QUAY_NS} event-streams-topic ${TAG} "${QUAY_TOKEN}"
@echo Remember to make https://quay.io/application/${QUAY_NS}/topic-operator public
.PHONY: lintall
lintall: fmt lint vet
lint:
golint -set_exit_status=true pkg/
check-tag:
ifndef TAG
$(error TAG is undefined! Please set TAG to the latest release tag, using the format x.y.z e.g. export TAG=0.1.1 )
endif
check-quayns:
ifndef QUAY_NS
$(error QUAY_NS is undefined!)
endif
check-quaytoken:
ifndef QUAY_TOKEN
$(error QUAY_TOKEN is undefined!)
endif