@@ -18,6 +18,7 @@ DOCKER_SBOM_PLUGIN_VERSION=0.6.1
1818# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
1919VERSION_FILE =version.json
2020CURRENT_VERSION := $(shell $(JQ ) -r .current $(VERSION_FILE ) )
21+ NEXT_VERSION := $(shell $(JQ ) -r .next $(VERSION_FILE ) )
2122VERSION ?= $(shell git describe --always --tags --dirty --broken | cut -c 2-)
2223BUILDTIME ?= $(shell date -u +"% Y-% m-% dT% H:% M:% SZ")
2324GITCOMMIT ?= $(shell git rev-parse --short HEAD 2> /dev/null || true)
@@ -32,13 +33,6 @@ ifdef EXPERIMENTAL
3233LD_FLAGS += -X $(VERSION_PACKAGE ) .Experimental=$(EXPERIMENTAL )
3334endif
3435
35- # NEXT_VERSION represents a version that is higher than anything released
36- # VERSION default value does not play well with the run target which might end up failing
37- # with errors such as:
38- # "version of the resource $Resource is higher than the operator version $VERSION"
39- # This happens if you use exported YAMLs from CLI and the dirty version is deemed a pre-release
40- NEXT_VERSION = 99.99.99-next
41-
4236# CHANNELS define the bundle channels used in the bundle.
4337# Add a new line here if you would like to change its default config. (E.g CHANNELS = "preview,fast,stable")
4438# To re-generate a bundle for other specific channels without changing the standard setup, you can:
@@ -188,6 +182,17 @@ SBOMS_DIR ?= template
188182
189183SHELLCHECK_OPTIONS ?= -e SC2086
190184
185+ DEFAULT_IMAGE_URL := localhost:5000/mongodb-atlas-kubernetes-operator:$(NEXT_VERSION ) -test
186+ export IMAGE_URL
187+
188+ ifndef IMAGE_URL
189+ IMAGE_URL := $(DEFAULT_IMAGE_URL )
190+ BUILD_DEPENDENCY := test-docker-image
191+ else
192+ $(info --- IMAGE_URL is set externally : $(IMAGE_URL ) )
193+ BUILD_DEPENDENCY :=
194+ endif
195+
191196.DEFAULT_GOAL := help
192197.PHONY : help
193198help : # # Show this help screen
@@ -246,7 +251,7 @@ envtest-assets:
246251 mkdir -p $(ENVTEST_ASSETS_DIR )
247252
248253.PHONY : e2e
249- e2e : bundle manifests run-kind # # Run e2e test. Command `make e2e label=cluster-ns` run cluster-ns test
254+ e2e : bundle manifests run-kind $( BUILD_DEPENDENCY ) # # Run e2e test. Command `make e2e label=cluster-ns` run cluster-ns test
250255 AKO_E2E_TEST=1 $(GINKGO ) $(shell pwd) /test/$@
251256
252257.PHONY : e2e2
@@ -488,6 +493,14 @@ all-platforms-docker: all-platforms
488493 docker build --build-arg BINARY_PATH=bin/linux/amd64 -f fast.Dockerfile -t manager-amd64 .
489494 docker build --build-arg BINARY_PATH=bin/linux/arm64 -f fast.Dockerfile -t manager-arm64 .
490495
496+ .PHONY : docker-image
497+ docker-image :
498+ docker build --build-arg BINARY_PATH=bin/$(TARGET_OS ) /$(TARGET_ARCH ) -f fast.Dockerfile -t $(DEFAULT_IMAGE_URL ) .
499+
500+ .PHONY : test-docker-image
501+ test-docker-image : docker-image run-kind
502+ docker push $(DEFAULT_IMAGE_URL )
503+
491504.PHONY : check-major-version
492505check-major-version : # # Check that VERSION starts with MAJOR_VERSION
493506 @VERSION_MAJOR=$$(echo "$(VERSION ) " | cut -d. -f1 | sed 's/v//' ) ; \
0 commit comments