Skip to content

Commit d33fcef

Browse files
Revert "Merge branch 'refactor_release' of https://github.com/openmcp-project/metrics-operator into refactor_release"
This reverts commit 90db8ba, reversing changes made to 0b3e72a.
1 parent 90db8ba commit d33fcef

File tree

1 file changed

+17
-31
lines changed

1 file changed

+17
-31
lines changed

Makefile

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ build-docker-binary: manifests generate fmt vet ## Build manager binary for Dock
227227
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o bin/manager-linux.amd64 cmd/main.go
228228

229229
.PHONY: docker-build
230-
docker-build: test build-docker-binary ## Build docker image with the manager.
230+
docker-build: build-docker-binary test ## Build docker image with the manager.
231231
$(CONTAINER_TOOL) build -t ${IMG} .
232232

233233
.PHONY: docker-push
@@ -237,14 +237,22 @@ docker-push: ## Push docker image with the manager.
237237
# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
238238
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
239239
# - able to use docker buildx . More info: https://docs.docker.com/build/buildx/
240-
# - be using containerd image store with docker. More Info: https://docs.docker.com/engine/storage/containerd/
241240
# - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/
242-
243-
PLATFORMS ?= linux/arm64,linux/amd64
244-
241+
# - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=<myregistry/image:<tag>> then the export will fail)
242+
# To properly provided solutions that supports more than one platform you should use this option.
243+
PLATFORMS ?= linux/arm64 linux/amd64
245244
.PHONY: docker-buildx
246-
docker-buildx: test
247-
$(CONTAINER_TOOL) buildx build --platform=$(PLATFORMS) --tag $(IMG) --load -f Dockerfile .
245+
docker-buildx: ## Build and tag docker image for each platform locally using --load
246+
sed '1 s/^FROM/FROM --platform=$${BUILDPLATFORM}/' Dockerfile > Dockerfile.cross
247+
$(CONTAINER_TOOL) buildx create --name project-v3-builder || true
248+
$(CONTAINER_TOOL) buildx use project-v3-builder
249+
@for platform in $(PLATFORMS); do \
250+
tag="$(IMG)-$$(echo $$platform | tr / -)"; \
251+
echo "Building $$tag for $$platform"; \
252+
$(CONTAINER_TOOL) buildx build --platform=$$platform --tag $$tag --load -f Dockerfile.cross .; \
253+
done
254+
$(CONTAINER_TOOL) buildx rm project-v3-builder
255+
rm Dockerfile.cross
248256

249257
#----------------------------------------------------------------------------------------------
250258
##@ Helm
@@ -367,36 +375,14 @@ dev-apply-metric-dynatrace-prod: ## Apply metric using Dynatrace production exam
367375

368376
#----------------------------------------------------------------------------------------------
369377
##@ Helm
370-
371-
HELM_VERSION ?= v3.18.0
372-
OCI_REGISTRY ?= ghcr.io/sap/charts
373-
374-
$(HELM): $(LOCALBIN)
375-
@if test -x $(LOCALBIN)/helm && ! $(LOCALBIN)/helm version --short | grep -q $(HELM_VERSION); then \
376-
echo "$(LOCALBIN)/helm version is not expected $(HELM_VERSION). Removing it before installing."; \
377-
rm -rf $(LOCALBIN)/helm; \
378-
fi
379-
test -s $(LOCALBIN)/helm || (curl -sSL https://get.helm.sh/helm-$(HELM_VERSION)-$(shell uname | tr '[:upper:]' '[:lower:]')-amd64.tar.gz | tar xz -C /tmp && \
380-
mv /tmp/$(shell uname | tr '[:upper:]' '[:lower:]')-amd64/helm $(LOCALBIN)/helm && \
381-
chmod +x $(LOCALBIN)/helm && \
382-
rm -rf /tmp/$(shell uname | tr '[:upper:]' '[:lower:]')-amd64)
383-
384-
.PHONY: helm-package
385-
helm-package: $(HELM) helm-chart
386-
$(LOCALBIN)/helm package charts/$(PROJECT_FULL_NAME)/ -d ./ --version $(shell cat VERSION)
387-
388-
.PHONY: helm-push
389-
helm-push: $(HELM)
390-
$(LOCALBIN)/helm push $(PROJECT_FULL_NAME)-$(shell cat VERSION).tgz oci://$(OCI_REGISTRY)
391-
392378
.PHONY: helm-chart
393379
helm-chart: ## Generate Helm chart files from templates.
394380
OPERATOR_VERSION=$(shell cat VERSION) envsubst < charts/$(PROJECT_FULL_NAME)/Chart.yaml.tpl > charts/$(PROJECT_FULL_NAME)/Chart.yaml
395381
OPERATOR_VERSION=$(shell cat VERSION) envsubst < charts/$(PROJECT_FULL_NAME)/values.yaml.tpl > charts/$(PROJECT_FULL_NAME)/values.yaml
396382

397383
.PHONY: helm-install-local
398-
helm-install-local: $(HELM) ## Install the Helm chart locally using the Docker image
399-
$(LOCALBIN)/helm upgrade --install $(PROJECT_FULL_NAME) charts/$(PROJECT_FULL_NAME)/ --set image.repository=$(IMG_BASE) --set image.tag=$(IMG_VERSION) --set image.pullPolicy=Never
384+
helm-install-local: ## Install the Helm chart locally using the Docker image
385+
helm upgrade --install $(PROJECT_FULL_NAME) charts/$(PROJECT_FULL_NAME)/ --set image.repository=$(IMG_BASE) --set image.tag=$(IMG_VERSION) --set image.pullPolicy=Never
400386
$(KIND) load docker-image ${IMG} --name=$(PROJECT_FULL_NAME)-dev
401387

402388
#----------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)