This repository has been archived by the owner on Dec 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
82 lines (64 loc) · 2.58 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
# SPDX-FileCopyrightText: 2018 SAP SE or an SAP affiliate company and Gardener contributors
#
# SPDX-License-Identifier: Apache-2.0
REGISTRY := eu.gcr.io/gardener-project
IMAGE_REPOSITORY := $(REGISTRY)/dnslb-controller-manager
IMAGE_TAG := $(shell cat VERSION)
#########################################
# Rules for local development scenarios #
#########################################
.PHONY: start
start:
go run cmd/dnslb-controller-manager/main.go --kubeconfig dev/kubeconfig-garden.yaml
#################################################################
# Rules related to binary build, Docker image build and release #
#################################################################
.PHONY: revendor
revendor:
@dep ensure -update
.PHONY: build
build:
@build/build
.PHONY: build-local
build-local:
@env LOCAL_BUILD=1 build/build
.PHONY: release
release: build build-local docker-images docker-login docker-push
.PHONY: docker-images
docker-images: build
@if [[ ! -f bin/rel/dnslb-controller-manager ]]; then echo "No binary found. Please run 'make build'"; false; fi
@docker build -t $(IMAGE_REPOSITORY):$(IMAGE_TAG) -t $(IMAGE_REPOSITORY):latest -f Dockerfile --rm .
.PHONY: docker-login
docker-login: docker-images
@gcloud auth activate-service-account --key-file .kube-secrets/gcr/gcr-readwrite.json
.PHONY: docker-push
docker-push: docker-login
@if ! docker images $(IMAGE_REPOSITORY) | awk '{ print $$2 }' | grep -q -F $(IMAGE_TAG); then echo "$(IMAGE_REPOSITORY) version $(IMAGE_TAG) is not yet built. Please run 'make docker-images'"; false; fi
@gcloud docker -- push $(IMAGE_REPOSITORY):$(IMAGE_TAG)
@gcloud docker -- push $(IMAGE_REPOSITORY):latest
.PHONY: clean
clean:
@rm -rf bin/
@rm -f *linux-amd64
@rm -f *darwin-amd64
#####################################################################
# Rules for verification, formatting, linting, testing and cleaning #
#####################################################################
.PHONY: verify
verify: check test
.PHONY: check
check:
@.ci/check
.PHONY: test
test:
@.ci/test
.PHONY: test-cov
test-cov:
@env COVERAGE=1 .ci/test
@echo "mode: set" > dnslb-controller-manager.coverprofile && find . -name "*.coverprofile" -type f | xargs cat | grep -v mode: | sort -r | awk '{if($$1 != last) {print $$0;last=$$1}}' >> dnslb-controller-manager.coverprofile
@go tool cover -html=dnslb-controller-manager.coverprofile -o=dnslb-controller-manager.coverage.html
@rm dnslb-controller-manager.coverprofile
.PHONY: test-clean
test-clean:
@find . -name "*.coverprofile" -type f -delete
@rm -f dnslb-controller-manager.coverage.html