@@ -69,13 +69,13 @@ IMAGE_TAG_BASE ?= $(UPLOADREGISTRY)/$(OPERATOR_NAME)-operator
6969BUNDLE_IMG ?= $(IMAGE_TAG_BASE ) -bundle:v$(VERSION )
7070
7171# Image URL to use all building/pushing image targets
72- IMG ?= $(IMAGE_TAG_BASE ) :$(VERSION )
72+ export IMG ?= $(IMAGE_TAG_BASE ) :$(VERSION )
7373OPERATOR_IMG ?= $(OPERATOR_NAME ) -operator:$(VERSION )
7474
7575# always release the console with the same tag as the operator and the other way around!
7676# Image base URL of the console plugin
77- CONSOLE_PLUGIN_IMAGE_BASE ?= $(IMAGE_TAG_BASE ) -console
78- CONSOLE_PLUGIN_IMAGE ?= $(CONSOLE_PLUGIN_IMAGE_BASE ) :$(VERSION )
77+ CONSOLE_PLUGIN_IMAGE_BASE ?= $(OPERATOR_NAME ) -operator -console
78+ export CONSOLE_PLUGIN_IMAGE ?= $(CONSOLE_PLUGIN_IMAGE_BASE ) :$(VERSION )
7979CONSOLE_PLUGIN_DOCKERFILE ?= console-plugin.Dockerfile
8080
8181# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
@@ -306,9 +306,7 @@ endef
306306.PHONY : bundle
307307bundle : manifests kustomize operator-sdk # # Generate bundle manifests and metadata, then validate generated files.
308308 $(OPERATOR_SDK ) generate kustomize manifests -q
309- cd config/manager && $(KUSTOMIZE ) edit set image controller=$(IMG )
310- cd config/console-plugin && $(KUSTOMIZE ) edit set image console-plugin=$(CONSOLE_PLUGIN_IMAGE )
311- $(KUSTOMIZE ) build config/manifests | $(OPERATOR_SDK ) generate bundle $(BUNDLE_GEN_FLAGS )
309+ $(KUSTOMIZE ) build config/manifests | envsubst | $(OPERATOR_SDK ) generate bundle $(BUNDLE_GEN_FLAGS )
312310 $(MAKE ) bundle-fixes bundle-date
313311 ./hack/set_openshift_minimum_version.sh
314312 $(OPERATOR_SDK ) bundle validate ./bundle
@@ -359,22 +357,6 @@ ifneq ($(origin CATALOG_BASE_IMG), undefined)
359357FROM_INDEX_OPT := --from-index $(CATALOG_BASE_IMG )
360358endif
361359
362- # Generate Dockerfile using the template. It uses envsubst to replace the value of the version label in the container
363- .PHONY : generate-dockerfile-console-plugin
364- generate-dockerfile-console-plugin :
365- VERSION=$(VERSION ) SUPPORTED_OCP_VERSIONS=$(SUPPORTED_OCP_VERSIONS ) envsubst < templates/console-plugin.Dockerfile.template > $(CONSOLE_PLUGIN_DOCKERFILE )
366-
367- .PHONY : console-build
368- console-build : generate-dockerfile-console-plugin # # Build the console image
369- @echo " Building console image with cache optimization..."
370- @podman pull $(CONSOLE_PLUGIN_IMAGE_BASE ) :latest 2> /dev/null || true
371- podman build -f $(CURPATH ) /$(CONSOLE_PLUGIN_DOCKERFILE ) -t ${CONSOLE_PLUGIN_IMAGE} .
372- podman tag ${CONSOLE_PLUGIN_IMAGE} $(CONSOLE_PLUGIN_IMAGE_BASE ) :latest
373-
374- .PHONY : console-push
375- console-push : # # Push the console image
376- podman push $(CONSOLE_PLUGIN_IMAGE )
377-
378360# Build an OLM catalog image by adding the bundle image to a simple catalog using the
379361# operator package manager tool, 'opm'. For more information see:
380362# https://olm.operatorframework.io/docs/reference/catalog-templates
@@ -417,3 +399,32 @@ super-linter: ## Runs super linter locally
417399 -v $(PWD ) :/tmp/lint:rw,z \
418400 -w /tmp/lint \
419401 ghcr.io/super-linter/super-linter@sha256:6c71bd17ab38ceb7acb5b93ef72f5c2288b5456a5c82693ded3ee8bb501bba7f # slim-v8.1.0
402+
403+ # #@ Console plugin tasks
404+ # Generate Dockerfile using the template. It uses envsubst to replace the value of the version label in the container
405+ .PHONY : generate-dockerfile-console-plugin
406+ generate-dockerfile-console-plugin :
407+ VERSION=$(VERSION ) SUPPORTED_OCP_VERSIONS=$(SUPPORTED_OCP_VERSIONS ) envsubst < templates/console-plugin.Dockerfile.template > $(CONSOLE_PLUGIN_DOCKERFILE )
408+
409+ .PHONY : console-multiarch-manifest
410+ console-multiarch-manifest : # # creates the buildah manifest for multi-arch images
411+ # The rm is needed due to bug https://www.github.com/containers/podman/issues/19757
412+ buildah manifest rm " ${REGISTRY} /${CONSOLE_PLUGIN_IMAGE} " || /bin/true
413+ buildah manifest create " ${REGISTRY} /${CONSOLE_PLUGIN_IMAGE} "
414+
415+ .PHONY : console-build-amd64
416+ console-build-amd64 : generate-dockerfile-console-plugin console-multiarch-manifest # # build the console in amd64
417+ @echo " Building the console amd64"
418+ buildah build --platform linux/amd64 --format docker -f $(CONSOLE_PLUGIN_DOCKERFILE ) -t " ${CONSOLE_PLUGIN_IMAGE} -amd64"
419+ buildah manifest add --arch=amd64 " ${REGISTRY} /${CONSOLE_PLUGIN_IMAGE} " " ${REGISTRY} /${CONSOLE_PLUGIN_IMAGE} -amd64"
420+
421+ .PHONY : console-build-arm64
422+ console-build-arm64 : generate-dockerfile-console-plugin console-multiarch-manifest # # build the console in amd64
423+ @echo " Building the console arm64"
424+ buildah build --platform linux/arm64 --format docker -f $(CONSOLE_PLUGIN_DOCKERFILE ) -t " ${CONSOLE_PLUGIN_IMAGE} -arm64"
425+ buildah manifest add --arch=arm64 " ${REGISTRY} /${CONSOLE_PLUGIN_IMAGE} " " ${REGISTRY} /${CONSOLE_PLUGIN_IMAGE} -arm64"
426+
427+ .PHONY : console-push
428+ console-push : # # Uploads the container to quay.io/validatedpatterns/${CONSOLE_PLUGIN_IMAGE}
429+ @echo " Uploading the ${REGISTRY} /${CONSOLE_PLUGIN_IMAGE} container to ${UPLOADREGISTRY} /${CONSOLE_PLUGIN_IMAGE} "
430+ buildah manifest push --all " ${REGISTRY} /${CONSOLE_PLUGIN_IMAGE} " " docker://${UPLOADREGISTRY} /${CONSOLE_PLUGIN_IMAGE} "
0 commit comments