@@ -24,6 +24,11 @@ GOBIN_DIR=$(abspath ./bin )
2424PATH := $(GOBIN_DIR ) :$(TOOLS_GOBIN_DIR ) :$(PATH )
2525TMPDIR := $(shell mktemp -d)
2626
27+ # Image build configuration
28+ # REV is the short git sha of latest commit.
29+ REV =$(shell git rev-parse --short HEAD)
30+ IMAGE_REPO ?= kube-bind
31+
2732# Detect the path used for the install target
2833ifeq (,$(shell go env GOBIN) )
2934INSTALL_GOBIN =$(shell go env GOPATH) /bin
@@ -296,20 +301,6 @@ test-e2e-contrib-kcp: $(DEX) $(KCP)
296301$(CONTRIBS_E2E ) :
297302 cd contrib/$(patsubst test-e2e-contrib-% ,% ,$@ ) && $(GO_TEST ) -race -count $(COUNT ) $(E2E_PARALLELISM_FLAG ) ./test/e2e/...
298303
299- DESTROY_KIND_CLUSTER ?= true
300- REUSE_KIND_CLUSTER_SUFFIX ?= ""
301- KIND_CLUSTER_NAME ?= kube-bind
302-
303- .PHONY : test-e2e-kind
304- test-e2e-kind : build image-local
305- echo " Running kube-bind e2e tests"
306- KUBE_BIND_BACKEND_IMAGE=$(KO_DOCKER_REPO ) /backend:$(REV ) \
307- KUBE_BIND_KONNECTOR_IMAGE=$(KO_DOCKER_REPO ) /konnector:$(REV ) \
308- $(GO_TEST ) -v ./test/e2e-kind/... \
309- -destroy-kind-cluster=$(DESTROY_KIND_CLUSTER ) \
310- -collect-logs=true
311- echo " Kube-bind e2e tests completed"
312-
313304.PHONY : test
314305ifdef USE_GOTESTSUM
315306test : $(GOTESTSUM )
@@ -385,38 +376,91 @@ deploy-docs: venv ## Deploy docs
385376 . $(VENV ) /activate; \
386377 REMOTE=$(REMOTE ) BRANCH=$(BRANCH ) docs/scripts/deploy-docs.sh
387378
388- # Image build configuration
389- # REV is the short git sha of latest commit.
390- REV =$(shell git rev-parse --short HEAD)
391- KIND_CLUSTER ?= backend
392- KO_DOCKER_REPO ?= kube-bind
393-
379+ # Example: make IMAGE_REPO=ghcr.io/<username> image-local
394380.PHONY : image-local
395381image-local :
396382 @echo " Building images locally with tag $( REV) "
397383 @command -v ko > /dev/null 2>&1 || { echo " ko not found. Install with: go install github.com/google/ko@latest" ; exit 1; }
398384
399385 @echo "Building konnector image locally..."
400- KO_DOCKER_REPO=$(KO_DOCKER_REPO ) ko build \
386+ KO_DOCKER_REPO=$(IMAGE_REPO ) ko build \
401387 --local \
402388 -B \
403389 -t $(REV) \
404390 ./cmd/konnector
405391
406392 @echo "Building backend image locally..."
407- KO_DOCKER_REPO=$(KO_DOCKER_REPO ) ko build \
393+ KO_DOCKER_REPO=$(IMAGE_REPO ) ko build \
408394 --local \
409395 -B \
410396 -t $(REV) \
411397 ./cmd/backend
412398
413- @echo "Successfully built local images with tag $(REV)"
399+ @echo "Successfully built local images:"
400+ @echo " $(IMAGE_REPO)/konnector:$(REV)"
401+ @echo " $(IMAGE_REPO)/backend:$(REV)"
402+
403+ .PHONY : helm-build-local
404+ helm-build-local : # # Build and package Helm charts locally for testing
405+ @echo " Building Helm charts locally..."
406+ @command -v helm > /dev/null 2>&1 || { echo " helm not found. Install from: https://helm.sh/docs/intro/install/" ; exit 1; }
407+
408+ @# Set chart version to semver format for local builds (0.0.0-<git-sha>)
409+ CHART_VERSION=" 0.0.0-$( REV) " ; \
410+ for chart_dir in deploy/charts/* /; do \
411+ if [ -f " $$ {chart_dir}Chart.yaml" ]; then \
412+ chart_name=$$(basename "$$chart_dir") ; \
413+ echo " Processing chart: $$ chart_name" ; \
414+ \
415+ cp " $$ {chart_dir}Chart.yaml" " $$ {chart_dir}Chart.yaml.bak" ; \
416+ sed -i.tmp " s/^version:.*/version: $$ CHART_VERSION/" " $$ {chart_dir}Chart.yaml" ; \
417+ sed -i.tmp " s/^appVersion:.*/appVersion: $$ CHART_VERSION/" " $$ {chart_dir}Chart.yaml" ; \
418+ rm -f " $$ {chart_dir}Chart.yaml.tmp" ; \
419+ \
420+ helm package " $$ chart_dir" --version " $$ CHART_VERSION" --destination ./bin/; \
421+ echo " Packaged: ./bin/$$ chart_name-$$ CHART_VERSION.tgz" ; \
422+ \
423+ mv " $$ {chart_dir}Chart.yaml.bak" " $$ {chart_dir}Chart.yaml" ; \
424+ fi ; \
425+ done
426+ @echo " Helm charts built successfully in ./bin/"
427+
428+ .PHONY : helm-clean
429+ helm-clean : # # Clean up built helm charts
430+ rm -f ./bin/* .tgz
431+
432+ .PHONY : helm-push-local
433+ helm-push-local : # # Push Helm charts to IMAGE_REPO registry
434+ @echo " Pushing Helm charts to registry: $( IMAGE_REPO) "
435+ @command -v helm > /dev/null 2>&1 || { echo " helm not found. Install from: https://helm.sh/docs/intro/install/" ; exit 1; }
436+
437+ CHART_VERSION=" 0.0.0-$( REV) " ; \
438+ export HELM_EXPERIMENTAL_OCI=1; \
439+ for chart_file in ./bin/* -$$ CHART_VERSION.tgz; do \
440+ if [ -f " $$ chart_file" ]; then \
441+ chart_filename=$$(basename "$$chart_file") ; \
442+ chart_name=$$ {chart_filename%-$$ CHART_VERSION.tgz}; \
443+ if [[ " $$ chart_name" =~ [[:space:]] ]]; then \
444+ echo " Skipping chart with invalid name: '$$ chart_name' (contains spaces)" ; \
445+ continue ; \
446+ fi ; \
447+ echo " Pushing $$ chart_name to $( IMAGE_REPO) " ; \
448+ helm push " $$ chart_file" " oci://$( IMAGE_REPO) /charts" ; \
449+ echo " Chart available at: oci://$( IMAGE_REPO) /charts/$$ chart_name:$$ CHART_VERSION" ; \
450+ fi ; \
451+ done
414452
415- .PHONY : kind-load
416- kind-load :
417- @echo " Loading images into kind cluster '$( KIND_CLUSTER) '"
418- kind load docker-image $(KO_DOCKER_REPO ) /konnector:$(REV ) --name $(KIND_CLUSTER )
419- kind load docker-image $(KO_DOCKER_REPO ) /backend:$(REV ) --name $(KIND_CLUSTER )
420- @echo " Successfully loaded images into kind cluster '$( KIND_CLUSTER) '"
453+ .PHONY : helm-test
454+ helm-test : helm-build-local # # Test Helm chart installation (dry-run)
455+ @echo " Testing Helm chart installation..."
456+ CHART_VERSION=" 0.0.0-$( REV) " ; \
457+ for chart_dir in deploy/charts/* /; do \
458+ if [ -f " $$ {chart_dir}Chart.yaml" ]; then \
459+ chart_name=$$(basename "$$chart_dir") ; \
460+ echo " Testing chart: $$ chart_name" ; \
461+ helm install test-$$ chart_name " ./bin/$$ chart_name-$$ CHART_VERSION.tgz" --dry-run --debug; \
462+ echo " ✓ Chart $$ chart_name passes dry-run test" ; \
463+ fi ; \
464+ done
421465
422466include Makefile.venv
0 commit comments