This repository has been archived by the owner on Feb 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
132 lines (105 loc) · 4.68 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
NAME := virtual-garden
REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
HACK_DIR := $(REPO_ROOT)/hack
VERSION := $(shell cat "$(REPO_ROOT)/VERSION")
EFFECTIVE_VERSION := $(VERSION)-$(shell git rev-parse HEAD)
LD_FLAGS := "-w $(shell $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/get-build-ld-flags.sh k8s.io/component-base $(REPO_ROOT)/VERSION $(NAME))"
REGISTRY := eu.gcr.io/gardener-project/development
VIRTUAL_GARDEN_DEPLOYER_IMAGE_REPOSITORY := $(REGISTRY)/images/virtual-garden
#########################################
# Rules for local development scenarios #
#########################################
.PHONY: start
start:
@LD_FLAGS=$(LD_FLAGS) \
./hack/local-development/start.sh "RECONCILE"
.PHONY: delete
delete:
@LD_FLAGS=$(LD_FLAGS) \
./hack/local-development/start.sh "DELETE"
#################################################################
# Rules related to binary build, Docker image build and release #
#################################################################
.PHONY: install
install:
@LD_FLAGS=$(LD_FLAGS) \
$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/install.sh ./...
.PHONY: docker-images
docker-images:
@echo "Building docker images for version $(EFFECTIVE_VERSION)"
@docker build --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) -t $(VIRTUAL_GARDEN_DEPLOYER_IMAGE_REPOSITORY):$(EFFECTIVE_VERSION) -f Dockerfile .
.PHONY: docker-push
docker-push:
@echo "Pushing docker images for version $(EFFECTIVE_VERSION) to registry $(REGISTRY)"
@if ! docker images $(VIRTUAL_GARDEN_DEPLOYER_IMAGE_REPOSITORY) | awk '{ print $$2 }' | grep -q -F $(EFFECTIVE_VERSION); then echo "$(VIRTUAL_GARDEN_DEPLOYER_IMAGE_REPOSITORY) version $(EFFECTIVE_VERSION) is not yet built. Please run 'make docker-images'"; false; fi
@docker push $(VIRTUAL_GARDEN_DEPLOYER_IMAGE_REPOSITORY):$(EFFECTIVE_VERSION)
.PHONY: docker-all
docker-all: docker-images docker-push
.PHONY: cnudie
cnudie:
@EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) ./hack/generate-cd.sh
.PHONY: push
push: docker-images docker-push cnudie
.PHONY: create-installation
create-installation:
@EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) ./hack/create-installation.sh
#####################################################################
# Rules for verification, formatting, linting, testing and cleaning #
#####################################################################
.PHONY: install-requirements
install-requirements:
@go install -mod=vendor $(REPO_ROOT)/vendor/github.com/onsi/ginkgo/ginkgo
@go install -mod=vendor github.com/golang/mock/mockgen
@go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
@$(REPO_ROOT)/hack/install-requirements.sh
.PHONY: revendor
revendor:
@GO111MODULE=on go mod vendor
@GO111MODULE=on go mod tidy -compat=1.17
@chmod +x $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/*
@$(REPO_ROOT)/hack/update-github-templates.sh
.PHONY: generate
generate:
@GO111MODULE=on go generate ./...
.PHONY: clean
clean:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/clean.sh ./cmd/... ./pkg/... ./test/...
.PHONY: check
check:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/check.sh --golangci-lint-config=./.golangci.yaml ./cmd/... ./pkg/... ./test/...
.PHONY: format
format:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/format.sh ./cmd ./pkg ./test
.PHONY: setup-testenv
setup-testenv:
@$(REPO_ROOT)/hack/setup-testenv.sh
.PHONY: test
test:
make setup-testenv
@go test -mod=vendor $(REPO_ROOT)/cmd/... $(REPO_ROOT)/pkg/...
.PHONY: test-e2e
test-e2e:
@REPO_ROOT=$(REPO_ROOT) ./hack/test-e2e.sh
.PHONY: test-cov
test-cov:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/test-cover.sh -r ./cmd/... ./pkg/...
.PHONY: test-clean
test-clean:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/test-cover-clean.sh
.PHONY: verify
verify: check format test
.PHONY: verify-extended
verify-extended: install-requirements check format test-cov test-clean