@@ -9,13 +9,7 @@ CONTAINER_ENGINE?=docker
99# To re-generate a bundle for another specific version without changing the standard setup, you can:
1010# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
1111# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
12- VERSION ?= 0.3.0
13-
14- ifndef PRODUCT_VERSION
15- PRODUCT_VERSION := $(shell git describe --tags --dirty --broken)
16- endif
17-
18- CONTAINER_ENGINE? =docker
12+ VERSION ?= $(shell git describe --tags --dirty --broken | cut -c 2-)
1913
2014# CHANNELS define the bundle channels used in the bundle.
2115# Add a new line here if you would like to change its default config. (E.g CHANNELS = "preview,fast,stable")
@@ -48,19 +42,16 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
4842
4943# Base registry for the operator, bundle, catalog images
5044REGISTRY ?= quay.io/mongodb
51- # Image URL to use all building/pushing image targets
52- IMG ?= $(REGISTRY ) /mongodb-atlas-kubernetes-dbaas
53- OPERATOR_REGISTRY ?= $(IMG )
54-
55- OPERATOR_IMG ?= $(IMG ) :$(VERSION )
56- # OPERATOR_IMG ?= $(IMG):latest
57-
58- BUNDLE_IMG ?= $(IMG ) -bundle:$(VERSION )
59- # BUNDLE_IMG ?= $(IMG)-bundle:latest
60-
61- CATALOG_IMG ?= $(IMG ) -catalog:$(VERSION )
62- # CATALOG_IMG ?= ${IMG}-catalog:latest
63-
45+ # BUNDLE_IMG defines the image:tag used for the bundle.
46+ # You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
47+ BUNDLE_IMG ?= $(REGISTRY ) /mongodb-atlas-kubernetes-operator-prerelease-bundle:$(VERSION )
48+
49+ # IMG ?= mongodb-atlas-kubernetes-operator:latest
50+ # BUNDLE_REGISTRY ?= $(REGISTRY)/mongodb-atlas-operator-bundle
51+ OPERATOR_REGISTRY ?= $(REGISTRY ) /mongodb-atlas-kubernetes-operator-prerelease
52+ CATALOG_REGISTRY ?= $(REGISTRY ) /mongodb-atlas-kubernetes-operator-prerelease-catalog
53+ OPERATOR_IMAGE ?= ${OPERATOR_REGISTRY}:${VERSION}
54+ CATALOG_IMAGE ?= ${CATALOG_REGISTRY}:${VERSION}
6455TARGET_NAMESPACE ?= mongodb-atlas-operator-system-test
6556
6657# Image URL to use all building/pushing image targets
@@ -185,46 +176,39 @@ rm -rf $$TMP_DIR ;\
185176endef
186177
187178.PHONY : bundle
188- bundle : manifests kustomize # # Generate bundle manifests and metadata, update security context for OpenShift, then validate generated files.
179+ bundle : manifests kustomize # # Generate bundle manifests and metadata, then validate generated files.
189180 @echo " Building bundle $( VERSION) "
190181 operator-sdk generate kustomize manifests -q --apis-dir=pkg/api
191- cd config/manager && $(KUSTOMIZE ) edit set image controller=$(OPERATOR_IMG )
192- $(KUSTOMIZE ) build --load-restrictor LoadRestrictionsNone config/manifests | operator-sdk generate bundle -q --overwrite --manifests -- version $(VERSION ) $(BUNDLE_METADATA_OPTS )
182+ cd config/manager && $(KUSTOMIZE ) edit set image controller=$(IMG )
183+ $(KUSTOMIZE ) build --load-restrictor LoadRestrictionsNone config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION ) $(BUNDLE_METADATA_OPTS )
193184 operator-sdk bundle validate ./bundle
194185
195186.PHONY : image
196- image : manager # # Build the operator image
197- $(CONTAINER_ENGINE ) build -t $(OPERATOR_IMG ) .
198- $(CONTAINER_ENGINE ) push $(OPERATOR_IMG )
187+ image : # # Build the operator image
188+ $(CONTAINER_ENGINE ) build --build-arg VERSION= $( VERSION ) - t $(OPERATOR_IMAGE ) .
189+ $(CONTAINER_ENGINE ) push $(OPERATOR_IMAGE )
199190
200191.PHONY : bundle-build
201192bundle-build : # # Build the bundle image.
202193 $(CONTAINER_ENGINE ) build -f bundle.Dockerfile -t $(BUNDLE_IMG ) .
203194
204195.PHONY : bundle-push
205- bundle-push : # # Push the bundle image.
196+ bundle-push :
206197 $(CONTAINER_ENGINE ) push $(BUNDLE_IMG )
207198
208- # A comma-separated list of bundle images (e.g. make catalog-build BUNDLE_IMGS=example.com/operator-bundle:v0.1.0,example.com/operator-bundle:v0.2.0).
209- # These images MUST exist in a registry and be pull-able.
210- BUNDLE_IMGS ?= $(BUNDLE_IMG )
211-
212199.PHONY : catalog-build
213200CATALOG_DIR ?= ./scripts/openshift/atlas-catalog
214- # catalog-build: IMG=
215- catalog-build : # # bundle bundle-push ## Build file-based bundle
216- $(MAKE ) image IMG=$(IMG )
201+ catalog-build : image
217202 CATALOG_DIR=$(CATALOG_DIR ) \
218203 CHANNEL=$(DEFAULT_CHANNEL ) \
219- CATALOG_IMAGE=$(CATALOG_IMG ) \
204+ CATALOG_IMAGE=$(CATALOG_IMAGE ) \
220205 BUNDLE_IMAGE=$(BUNDLE_IMG ) \
221206 VERSION=$(VERSION ) \
222- CONTAINER_ENGINE=$(CONTAINER_ENGINE ) \
223207 ./scripts/build_catalog.sh
224208
225209.PHONY : catalog-push
226210catalog-push :
227- $(CONTAINER_ENGINE ) push $(CATALOG_IMG )
211+ $(CONTAINER_ENGINE ) push $(CATALOG_IMAGE )
228212
229213.PHONY : build-subscription
230214build-subscription :
@@ -242,7 +226,6 @@ build-catalogsource:
242226
243227.PHONY : deploy-olm
244228# Deploy atlas operator to the running openshift cluster with OLM
245- deploy-olm : export IMG=$(OPERATOR_IMAGE )
246229deploy-olm : bundle-build bundle-push catalog-build catalog-push build-catalogsource build-subscription
247230 oc -n openshift-marketplace delete catalogsource mongodb-atlas-kubernetes-local --ignore-not-found
248231 oc delete namespace $(TARGET_NAMESPACE ) --ignore-not-found
@@ -258,7 +241,7 @@ deploy-olm: bundle-build bundle-push catalog-build catalog-push build-catalogsou
258241
259242.PHONY : image-push
260243image-push : # # Push the docker image
261- $(CONTAINER_ENGINE ) push ${OPERATOR_IMG }
244+ $(CONTAINER_ENGINE ) push ${IMG }
262245
263246# Additional make goals
264247.PHONY : run-kind
0 commit comments