44# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
55# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
66VERSION ?= 0.0.1-alpha2
7+ PREVIOUS_VERSION ?= 0.0.1-alpha1
78
89# CHANNELS define the bundle channels used in the bundle.
910# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
@@ -291,6 +292,7 @@ BUNDLE_IMGS ?= $(BUNDLE_IMG)
291292# The image tag given to the resulting catalog image (e.g. make catalog-build CATALOG_IMG=example.com/operator-catalog:v0.2.0).
292293CATALOG_IMG ?= $(IMAGE_TAG_BASE ) -catalog:v$(VERSION )
293294CATALOG_IMG_LATEST ?= $(IMAGE_TAG_BASE ) -catalog:latest
295+ CATALOG_PREVIOUS_IMG ?= $(IMAGE_TAG_BASE ) -catalog:v$(PREVIOUS_VERSION )
294296
295297# Set CATALOG_BASE_IMG to an existing catalog image tag to add $BUNDLE_IMGS to that image.
296298ifneq ($(origin CATALOG_BASE_IMG ) , undefined)
@@ -302,14 +304,16 @@ endif
302304# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
303305.PHONY : catalog-build
304306catalog-build : opm # # Build a catalog image.
305- $(OPM ) render $(BUNDLE_IMGS ) > catalog/released/$(VERSION ) .json
307+ $(OPM ) render $(BUNDLE_IMGS ) > catalog/$(VERSION ) .json
308+ $(OPM ) render $(CATALOG_PREVIOUS_IMG ) | jq -r ' select(.schema == "olm.bundle")' > catalog/previous_bundles.json
306309 $(OPM ) generate dockerfile catalog -i quay.io/operator-framework/opm:${OPM_VERSION}
307310 # # Apending Final stage for ppc64le
308311 echo "FROM quay.io/operator-framework/opm:$(OPM_VERSION)-ppc64le" >> catalog.Dockerfile
309312 cat hack/Dockerfile_final_stage >> catalog.Dockerfile
310313 # # Building catalog image
311314 $(CONTAINER_TOOL) build -f catalog.Dockerfile -t $(CATALOG_IMG) -t $(CATALOG_IMG_LATEST) .
312315 rm -rf catalog.Dockerfile
316+ rm -rf catalog/$(VERSION).json
313317
314318# Push the catalog image.
315319.PHONY : catalog-push
0 commit comments