forked from gardener/external-dns-management
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
110 lines (89 loc) · 3.55 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
104
105
106
107
108
REGISTRY := eu.gcr.io/gardener-project
EXECUTABLE := dns-controller-manager
PROJECT := github.com/gardener/external-dns-management
IMAGE_REPOSITORY := $(REGISTRY)/dns-controller-manager
VERSION := $(shell cat VERSION)
IMAGE_TAG := $(VERSION)
EFFECTIVE_VERSION := $(VERSION)-$(shell git rev-parse HEAD)
.PHONY: revendor
revendor:
@GO111MODULE=on go mod tidy
@GO111MODULE=on go mod vendor
.PHONY: check
check:
@.ci/check
.PHONY: build
build:
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -o $(EXECUTABLE) \
-mod=vendor \
-ldflags "-X main.Version=$(VERSION)-$(shell git rev-parse HEAD)"\
./cmd/compound
.PHONY: build-local
build-local:
@CGO_ENABLED=1 GO111MODULE=on go build -o $(EXECUTABLE) \
-mod=vendor \
-race \
-ldflags "-X main.Version=$(VERSION)-$(shell git rev-parse HEAD)"\
./cmd/compound
.PHONY: build-local-dedicated
build-local-dedicated:
@CGO_ENABLED=1 GO111MODULE=on go build -o $(EXECUTABLE)-dedicated \
-mod=vendor \
-race \
-gcflags="all=-N -l" \
-ldflags "-X main.Version=$(VERSION)-$(shell git rev-parse HEAD)"\
./cmd/dedicated
.PHONY: release
release:
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -o $(EXECUTABLE) \
-a \
-mod=vendor \
-ldflags "-w -X main.Version=$(VERSION)" \
./cmd/compound
.PHONY: test
test:
GO111MODULE=on go test -mod=vendor ./pkg/...
@echo ----- Skipping long running integration tests, use \'make alltests\' to run all tests -----
test/integration/run.sh $(kindargs) -- -skip Many $(args)
.PHONY: generate-proto
generate-proto:
@protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
--experimental_allow_proto3_optional \
pkg/server/remote/common/remote.proto
.PHONY: generate
generate:
@./hack/generate-code
@GO111MODULE=on go generate ./pkg/apis/dns/...
@GO111MODULE=on go generate ./charts/external-dns-management
.PHONY: install-requirements
install-requirements:
@go install -mod=vendor github.com/onsi/ginkgo/v2/ginkgo
@GO111MODULE=off go get golang.org/x/tools/cmd/goimports
@./hack/install-requirements.sh
alltests:
GO111MODULE=on go test -mod=vendor ./pkg/...
test/integration/run.sh $(kindargs) -- $(args)
.PHONY: docker-images
docker-images:
@docker build -t $(IMAGE_REPOSITORY):$(IMAGE_TAG) -f build/Dockerfile .
#####################################################################
# Rules for cnudie component descriptors dev setup #
#####################################################################
.PHONY: cnudie-docker-images
cnudie-docker-images:
@echo "Building docker images for version $(EFFECTIVE_VERSION) for registry $(IMAGE_REPOSITORY)"
@docker build -t $(IMAGE_REPOSITORY):$(EFFECTIVE_VERSION) -f build/Dockerfile .
.PHONY: cnudie-docker-push
cnudie-docker-push:
@echo "Pushing docker images for version $(EFFECTIVE_VERSION) to registry $(IMAGE_REPOSITORY)"
@if ! docker images $(IMAGE_REPOSITORY) | awk '{ print $$2 }' | grep -q -F $(EFFECTIVE_VERSION); then echo "$(IMAGE_REPOSITORY) version $(EFFECTIVE_VERSION) is not yet built. Please run 'make cnudie-docker-images'"; false; fi
@docker push $(IMAGE_REPOSITORY):$(EFFECTIVE_VERSION)
.PHONY: cnudie-docker-all
cnudie-docker-all: cnudie-docker-images cnudie-docker-push
.PHONY: cnudie-cd-build-push
cnudie-cd-build-push:
@EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) ./hack/generate-cd.sh
.PHONY: cnudie-create-installation
cnudie-create-installation:
@EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) ./hack/create-installation.sh