-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathMakefile
53 lines (40 loc) · 1.85 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
NAME := naiserator
TAG := navikt/${NAME}
LATEST := ${TAG}:latest
ROOT_DIR := $(shell git rev-parse --show-toplevel)
K8S_VERSION := 1.30.0
arch := $(shell uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/)
os := $(shell uname -s | tr '[:upper:]' '[:lower:]')
testbin_dir := ./.testbin/
tools_archive := kubebuilder-tools-${K8S_VERSION}-$(os)-$(arch).tar.gz
PROTOC = $(shell which protoc)
.PHONY: build docker docker-push local install test proto kubebuilder
build:
go build -o cmd/naiserator/naiserator ./cmd/naiserator
go build -o cmd/naiserator_webhook/naiserator_webhook ./cmd/naiserator_webhook
docker:
docker image build -t ${TAG}:$(shell ./version.sh) -t ${TAG} -t ${NAME} -t ${LATEST} -f Dockerfile .
docker-push:
docker image push ${TAG}:$(shell /bin/cat ./version)
docker image push ${LATEST}
local:
go run cmd/naiserator/main.go --kubeconfig=${KUBECONFIG} --bind=127.0.0.1:8080
install:
cd cmd/naiserator && go install
test: kubebuilder
go test ./... -count=1 --coverprofile=cover.out
golden_file_test:
go test ./pkg/resourcecreator/resourcecreator_golden_files_test.go -count=1
kubebuilder: $(testbin_dir)/$(tools_archive)
tar -xzf $(testbin_dir)/$(tools_archive) --strip-components=2 -C $(testbin_dir)
chmod -R +x $(testbin_dir)
$(testbin_dir)/$(tools_archive):
mkdir -p $(testbin_dir)
wget -q --directory-prefix=$(testbin_dir) "https://storage.googleapis.com/kubebuilder-tools/$(tools_archive)"
proto:
wget -O pkg/event/event.proto https://raw.githubusercontent.com/navikt/protos/master/deployment/event.proto
$(PROTOC) --go_opt=Mpkg/event/event.proto=github.com/nais/naiserator/pkg/deployment,paths=source_relative --go_out=. pkg/event/event.proto
rm -f pkg/event/event.proto
install-protobuf-go:
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc