This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 984a754c8367e224a326370f02e87a06217faa78
Author: phantomjinx <[email protected]>
AuthorDate: Thu Dec 2 14:32:09 2021 +0000

    Fix: Retrieve IMAGE_NAME value from deployment yaml rather than constant
    
    * It is possible if set-version has been called, eg. building bundle, for
      the image name in the operator-deployment.yaml to be different to that
      defined by IMAGE_NAME. This can cause issues when calling functions
      such as `kustomize set image $(IMAGE_NAME)=....` as this will work but
      the image name in the deployment will never be updated (wrong mapping).
    
    * Use a shell function to find the latest value of IMAGE_NAME & assign
      each time a Makefile rule  in install is executed.
---
 install/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/install/Makefile b/install/Makefile
index bbc5a91..faf8466 100644
--- a/install/Makefile
+++ b/install/Makefile
@@ -59,6 +59,9 @@ OPERATOR := operator
 PLACEHOLDER := placeholder
 YAML := yaml
 
+# Fetch the latest image name - may override the original constant
+IMAGE_NAME := $(shell grep image: $(MANAGER)/operator-deployment.yaml | sed 
's/.*image: \(.*\):.*/\1/')
+
 # Setup patches
 ROLE_TO_CROLE_PATCH := $(RBAC)/patch-role-to-clusterrole
 ROLEBIN_TO_CROLEBIN_PATCH := $(RBAC)/patch-rolebinding-to-clusterrolebinding
@@ -77,6 +80,7 @@ INT_PLATFORM_PATCH := patch-integration-platform
 #
 define set-kustomize-image
        $(if $(filter $(IMAGE_NAME),$(CUSTOM_IMAGE):$(CUSTOM_VERSION)),,\
+
                @cd $(1) && $(KUSTOMIZE) edit set image 
$(IMAGE_NAME)=$(CUSTOM_IMAGE):$(CUSTOM_VERSION))
 endef
 

Reply via email to