-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
99 lines (77 loc) · 4.89 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
# SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors
#
# SPDX-License-Identifier: Apache-2.0
REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
VERSION := $(shell cat $(REPO_ROOT)/VERSION)
EFFECTIVE_VERSION := $(VERSION)-$(shell git rev-parse HEAD)
REGISTRY := eu.gcr.io/gardener-project/landscaper-service
LANDSCAPER_SERVICE_CONTROLLER_IMAGE_REPOSITORY := $(REGISTRY)/landscaper-service-controller
LANDSCAPER_SERVICE_WEBHOOKS_SERVER_IMAGE_REPOSITORY := $(REGISTRY)/landscaper-service-webhooks-server
LANDSCAPER_SERVICE_TARGET_SHOOT_SIDECAR_SERVER_IMAGE_REPOSITORY := $(REGISTRY)/landscaper-service-target-shoot-sidecar-server
.PHONY: install-requirements
install-requirements:
@go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
@$(REPO_ROOT)/hack/install-requirements.sh
.PHONY: revendor
revendor:
@$(REPO_ROOT)/hack/revendor.sh
@cd $(REPO_ROOT)/integration-test && $(REPO_ROOT)/hack/revendor.sh
.PHONY: format
format:
@$(REPO_ROOT)/hack/format.sh $(REPO_ROOT)/pkg $(REPO_ROOT)/cmd $(REPO_ROOT)/hack $(REPO_ROOT)/test $(REPO_ROOT)/integration-test/pkg
.PHONY: check
check: revendor check-fast
.PHONY: check-fast
check-fast:
@$(REPO_ROOT)/hack/check.sh --golangci-lint-config=./.golangci.yaml $(REPO_ROOT)/cmd/... $(REPO_ROOT)/pkg/... $(REPO_ROOT)/hack/... $(REPO_ROOT)/test/...
@cd $(REPO_ROOT)/integration-test && $(REPO_ROOT)/hack/check.sh --golangci-lint-config=$(REPO_ROOT)/.golangci.yaml ./pkg/...
.PHONY: verify
verify: check
.PHONY: setup-testenv
setup-testenv:
@$(REPO_ROOT)/hack/setup-testenv.sh
.PHONY: test
test: setup-testenv
@$(REPO_ROOT)/hack/test.sh
.PHONY: integration-test
integration-test:
@cd $(REPO_ROOT)/integration-test && go run ./pkg --kubeconfig $(KUBECONFIG) --laas-version $(EFFECTIVE_VERSION) --laas-repository $(REGISTRY) --provider-type $(CLUSTER_PROVIDER_TYPE)
.PHONY: generate-code
generate-code:
@cd $(REPO_ROOT)/pkg/apis && $(REPO_ROOT)/hack/generate.sh ./... && cd $(REPO_ROOT)
.PHONY: generate
generate: generate-code format revendor
#################################################################
# Rules related to binary build, docker image build and release #
#################################################################
.PHONY: install
install:
@EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) ./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 $(LANDSCAPER_SERVICE_CONTROLLER_IMAGE_REPOSITORY):$(EFFECTIVE_VERSION) -f Dockerfile --target landscaper-service-controller .
@docker build --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) -t $(LANDSCAPER_SERVICE_WEBHOOKS_SERVER_IMAGE_REPOSITORY):$(EFFECTIVE_VERSION) -f Dockerfile --target landscaper-service-webhooks-server .
@docker build --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) -t $(LANDSCAPER_SERVICE_TARGET_SHOOT_SIDECAR_SERVER_IMAGE_REPOSITORY):$(EFFECTIVE_VERSION) -f Dockerfile --target landscaper-service-target-shoot-sidecar-server .
.PHONY: docker-push
docker-push:
@echo "Pushing docker images for version $(EFFECTIVE_VERSION) to registry $(REGISTRY)"
@if ! docker images $(LANDSCAPER_SERVICE_CONTROLLER_IMAGE_REPOSITORY) | awk '{ print $$2 }' | grep -q -F $(EFFECTIVE_VERSION); then echo "$(LANDSCAPER_SERVICE_CONTROLLER_IMAGE_REPOSITORY) version $(EFFECTIVE_VERSION) is not yet built. Please run 'make docker-images'"; false; fi
@if ! docker images $(LANDSCAPER_SERVICE_WEBHOOKS_SERVER_IMAGE_REPOSITORY) | awk '{ print $$2 }' | grep -q -F $(EFFECTIVE_VERSION); then echo "$(LANDSCAPER_SERVICE_WEBHOOKS_SERVER_IMAGE_REPOSITORY) version $(EFFECTIVE_VERSION) is not yet built. Please run 'make docker-images'"; false; fi
@if ! docker images $(LANDSCAPER_SERVICE_TARGET_SHOOT_SIDECAR_SERVER_IMAGE_REPOSITORY) | awk '{ print $$2 }' | grep -q -F $(EFFECTIVE_VERSION); then echo "$(LANDSCAPER_SERVICE_TARGET_SHOOT_SIDECAR_SERVER_IMAGE_REPOSITORY) version $(EFFECTIVE_VERSION) is not yet built. Please run 'make docker-images'"; false; fi
@docker push $(LANDSCAPER_SERVICE_CONTROLLER_IMAGE_REPOSITORY):$(EFFECTIVE_VERSION)
@docker push $(LANDSCAPER_SERVICE_WEBHOOKS_SERVER_IMAGE_REPOSITORY):$(EFFECTIVE_VERSION)
@docker push $(LANDSCAPER_SERVICE_TARGET_SHOOT_SIDECAR_SERVER_IMAGE_REPOSITORY):$(EFFECTIVE_VERSION)
.PHONY: docker-all
docker-all: docker-images docker-push
.PHONY: cnudie
cnudie:
@$(REPO_ROOT)/hack/generate-cd.sh
.PHONY: helm-charts
helm-charts:
@$(REPO_ROOT)/.ci/publish-helm-charts
.PHONY: build-resources
build-resources: docker-all helm-charts cnudie
.PHONY: build-int-test-image
build-int-test-image:
@docker buildx build --platform linux/amd64 integration-test/docker -t eu.gcr.io/gardener-project/landscaper-service/integration-test:1.20.6-alpine3.18 --push