forked from gardener/landscaper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
139 lines (109 loc) · 9.05 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
133
134
135
136
137
138
139
# SPDX-FileCopyrightText: 2019 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 := $(shell $(REPO_ROOT)/hack/get-version.sh)
REGISTRY := europe-docker.pkg.dev/sap-gcp-cp-k8s-stable-hub/landscaper
DOCKER_BUILDER_NAME := "ls-multiarch"
DOCKER_PLATFORM_AMD64 := "linux/amd64"
DOCKER_PLATFORM_ARM64 := "linux/arm64"
DISABLE_CLEANUP := false
.PHONY: install-requirements
install-requirements:
@go install -mod=vendor $(REPO_ROOT)/vendor/github.com/ahmetb/gen-crd-api-reference-docs
@go install -mod=vendor $(REPO_ROOT)/vendor/github.com/golang/mock/mockgen
@go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
@$(REPO_ROOT)/hack/install-requirements.sh
@chmod +x $(REPO_ROOT)/apis/vendor/k8s.io/code-generator/*
.PHONY: revendor
revendor:
@$(REPO_ROOT)/hack/revendor.sh
@cd $(REPO_ROOT)/apis && $(REPO_ROOT)/hack/revendor.sh
@cd $(REPO_ROOT)/controller-utils && $(REPO_ROOT)/hack/revendor.sh
@chmod +x $(REPO_ROOT)/apis/vendor/k8s.io/code-generator/*
.PHONY: format
format:
@$(REPO_ROOT)/hack/format.sh $(REPO_ROOT)/apis/config $(REPO_ROOT)/apis/core $(REPO_ROOT)/apis/deployer $(REPO_ROOT)/apis/errors $(REPO_ROOT)/apis/mediatype $(REPO_ROOT)/apis/openapi $(REPO_ROOT)/apis/schema $(REPO_ROOT)/pkg $(REPO_ROOT)/test $(REPO_ROOT)/cmd $(REPO_ROOT)/hack $(REPO_ROOT)/controller-utils/pkg
.PHONY: check
check: format
@$(REPO_ROOT)/hack/verify-docs-index.sh
@$(REPO_ROOT)/hack/check.sh --golangci-lint-config=./.golangci.yaml $(REPO_ROOT)/hack/testcluster/...
@$(REPO_ROOT)/hack/check.sh --golangci-lint-config=./.golangci.yaml $(REPO_ROOT)/cmd/... $(REPO_ROOT)/pkg/... $(REPO_ROOT)/test/...
@cd $(REPO_ROOT)/apis && $(REPO_ROOT)/hack/check.sh --golangci-lint-config=../.golangci.yaml $(REPO_ROOT)/apis/config/... $(REPO_ROOT)/apis/core/... $(REPO_ROOT)/apis/deployer/... $(REPO_ROOT)/apis/errors/... $(REPO_ROOT)/apis/mediatype/... $(REPO_ROOT)/apis/openapi/... $(REPO_ROOT)/apis/schema/...
@cd $(REPO_ROOT)/controller-utils && $(REPO_ROOT)/hack/check.sh --golangci-lint-config=../.golangci.yaml $(REPO_ROOT)/controller-utils/pkg/...
.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:
@$(REPO_ROOT)/hack/local-integration-test $(KUBECONFIG_PATH) $(EFFECTIVE_VERSION) $(USE_OCM_LIB)
.PHONY: integration-test-pure
integration-test-pure:
@$(REPO_ROOT)/hack/local-integration-test-pure $(KUBECONFIG_PATH) $(EFFECTIVE_VERSION)
.PHONY: integration-test-with-cluster-creation
integration-test-with-cluster-creation:
@$(REPO_ROOT)/hack/local-integration-test-with-cluster-creation $(KUBECONFIG_PATH) garden-laas $(EFFECTIVE_VERSION) 0 $(USE_OCM_LIB)
.PHONY: verify
verify: check
.PHONY: generate-code
generate-code:
@cd $(REPO_ROOT)/apis && $(REPO_ROOT)/hack/generate.sh ./... && cd $(REPO_ROOT)
@$(REPO_ROOT)/hack/generate.sh $(REPO_ROOT)/pkg... $(REPO_ROOT)/test... $(REPO_ROOT)/cmd...
.PHONY: generate-docs
generate-docs:
@$(REPO_ROOT)/hack/generate-docs-index.sh
.PHONY: generate
generate: generate-code format revendor generate-docs
#################################################################
# 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:
@$(REPO_ROOT)/hack/prepare-docker-builder.sh
@echo "Building docker images for version $(EFFECTIVE_VERSION) / $(DOCKER_PLATFORM_AMD64)"
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t landscaper-controller:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target landscaper-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t landscaper-webhooks-server:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target landscaper-webhooks-server .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t landscaper-agent:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target landscaper-agent .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t container-deployer-controller:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target container-deployer-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t container-deployer-init:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target container-deployer-init .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t container-deployer-wait:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target container-deployer-wait .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t helm-deployer-controller:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target helm-deployer-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t manifest-deployer-controller:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target manifest-deployer-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_AMD64) -t mock-deployer-controller:$(EFFECTIVE_VERSION)-linux-amd64 -f Dockerfile --target mock-deployer-controller .
@echo "Building docker images for version $(EFFECTIVE_VERSION) / $(DOCKER_PLATFORM_ARM64)"
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t landscaper-controller:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target landscaper-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t landscaper-webhooks-server:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target landscaper-webhooks-server .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t landscaper-agent:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target landscaper-agent .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t container-deployer-controller:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target container-deployer-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t container-deployer-init:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target container-deployer-init .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t container-deployer-wait:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target container-deployer-wait .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t helm-deployer-controller:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target helm-deployer-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t manifest-deployer-controller:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target manifest-deployer-controller .
@docker buildx build --builder $(DOCKER_BUILDER_NAME) --load --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --platform $(DOCKER_PLATFORM_ARM64) -t mock-deployer-controller:$(EFFECTIVE_VERSION)-linux-arm64 -f Dockerfile --target mock-deployer-controller .
.PHONY: component
component:
@$(REPO_ROOT)/hack/generate-cd.sh $(REGISTRY)
.PHONY: build-resources
build-resources: docker-images component
######################
# Tutorial resources #
######################
.PHONY: upload-tutorial-resources
upload-tutorial-resources:
@./hack/upload-tutorial-resources.sh
######################
# Local development #
######################
.PHONY: install-testcluster-cmd
install-testcluster-cmd:
@go install $(REPO_ROOT)/hack/testcluster
.PHONY: start-webhooks
start-webhooks:
@go run $(REPO_ROOT)/cmd/landscaper-webhooks-server -v 3 --kubeconfig=$(KUBECONFIG)