@@ -59,7 +59,15 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
5959
6060# BUNDLE_IMAGE defines the image:tag used for the bundle.
6161# You can use it as an arg. (E.g make bundle-build BUNDLE_IMAGE=<some-registry>/<project-name-bundle>:<tag>)
62- BUNDLE_IMAGE ?= gpu-operator-bundle:$(VERSION )
62+ BUNDLE_IMAGE_NAME ?= gpu-operator-bundle
63+ BUNDLE_VERSION ?= $(VERSION )
64+ BUNDLE_GIT_TAG ?= $(GIT_COMMIT )
65+ OPERATOR_IMAGE_NAME ?= gpu-operator
66+ OPERATOR_VERSION ?= $(VERSION )
67+ BUNDLE_CSV_FILE ?= bundle/manifests/gpu-operator-certified.clusterserviceversion.yaml
68+
69+ BUNDLE_IMAGE := $(BUNDLE_IMAGE_NAME ) :$(BUNDLE_VERSION )
70+ BUNDLE_IMAGE_GIT := $(if $(BUNDLE_GIT_TAG ) ,$(BUNDLE_IMAGE_NAME ) :$(BUNDLE_GIT_TAG ) )
6371
6472# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
6573ifeq (,$(shell go env GOBIN) )
@@ -126,16 +134,26 @@ bundle: manifests install-tools
126134 $(KUSTOMIZE ) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION ) $(BUNDLE_METADATA_OPTS )
127135 operator-sdk bundle validate ./bundle
128136
137+ # Update the bundle CSV file with operator image tag
138+ update-bundle-csv :
139+ @echo " Updating GPU operator image in $( BUNDLE_CSV_FILE) to $( OPERATOR_IMAGE_NAME) :$( OPERATOR_VERSION) "
140+ @sed -i' ' -e ' s|ghcr.io/nvidia/gpu-operator:[^ "]*|$(OPERATOR_IMAGE_NAME):$(OPERATOR_VERSION)|g' $(BUNDLE_CSV_FILE )
141+ @echo " Bundle CSV updated successfully"
142+
129143# Build the bundle image.
130- build-bundle-image :
144+ build-bundle-image : update-bundle-csv
131145 $(DOCKER ) build \
132146 --build-arg DEFAULT_CHANNEL=$(DEFAULT_CHANNEL ) \
133147 --build-arg GIT_COMMIT=$(GIT_COMMIT ) \
134- -f docker/bundle.Dockerfile -t $(BUNDLE_IMAGE ) .
148+ -f docker/bundle.Dockerfile \
149+ -t $(BUNDLE_IMAGE ) \
150+ $(if $(BUNDLE_IMAGE_GIT ) ,-t $(BUNDLE_IMAGE_GIT ) ) \
151+ .
135152
136153# Push the bundle image.
137154push-bundle-image : build-bundle-image
138155 $(DOCKER ) push $(BUNDLE_IMAGE )
156+ $(if $(BUNDLE_IMAGE_GIT ) ,$(DOCKER ) push $(BUNDLE_IMAGE_GIT ) )
139157
140158# Define local and dockerized golang targets
141159
0 commit comments