diff --git a/Makefile b/Makefile index 5d7b7114..63716c7c 100644 --- a/Makefile +++ b/Makefile @@ -291,6 +291,17 @@ bundle-community-k8s: bundle-community ## Generate bundle manifests and metadata bundle-community: bundle ##Add Community Edition suffix to operator name sed -r -i "s|displayName: Self Node Remediation Operator.*|displayName: Self Node Remediation Operator - Community Edition|;" ${BUNDLE_CSV} +# Split the VERSION into major, minor, and patch parts +MAJOR := $(word 1, $(subst ., ,$(VERSION))) +MINOR := $(word 2, $(subst ., ,$(VERSION))) +PATCH := $(word 3, $(subst ., ,$(VERSION))) + +# Subtract 1 from the MINOR part +NEW_MINOR := $(shell echo $$(($(MINOR) - 1))) + +# Recreate the DEC_VERSION variable +DEC_VERSION := $(MAJOR).$(NEW_MINOR).$(PATCH) + .PHONY: bundle-update bundle-update: ## Update containerImage, createdAt, skipRange, and icon fields in the bundle's CSV, then validate the bundle directory # update container image in the metadata @@ -299,6 +310,8 @@ bundle-update: ## Update containerImage, createdAt, skipRange, and icon fields i sed -r -i "s|createdAt: \".*\"|createdAt: \"`date "+%Y-%m-%d %T" `\"|;" ${BUNDLE_CSV} # set skipRange sed -r -i "s|olm.skipRange: .*|olm.skipRange: '>=0.4.0 <${VERSION}'|;" ${BUNDLE_CSV} + # set replaces + sed -r -i "s|replaces: .*|replaces: self-node-remediation.v${DEC_VERSION}|;" ${BUNDLE_CSV} # set icon (not version or build date related, but just to not having this huge data permanently in the CSV) sed -r -i "s|base64data:.*|base64data: ${ICON_BASE64}|;" ${BUNDLE_CSV} $(MAKE) bundle-validate diff --git a/bundle/manifests/self-node-remediation.clusterserviceversion.yaml b/bundle/manifests/self-node-remediation.clusterserviceversion.yaml index 91d9810f..3e1f691d 100644 --- a/bundle/manifests/self-node-remediation.clusterserviceversion.yaml +++ b/bundle/manifests/self-node-remediation.clusterserviceversion.yaml @@ -439,6 +439,7 @@ spec: provider: name: Medik8s url: https://www.medik8s.io/ + replaces: self-node-remediation.v0.0.0 version: 0.0.1 webhookdefinitions: - admissionReviewVersions: diff --git a/config/manifests/bases/self-node-remediation.clusterserviceversion.yaml b/config/manifests/bases/self-node-remediation.clusterserviceversion.yaml index 2ad04d15..dfda501a 100644 --- a/config/manifests/bases/self-node-remediation.clusterserviceversion.yaml +++ b/config/manifests/bases/self-node-remediation.clusterserviceversion.yaml @@ -124,4 +124,5 @@ spec: provider: name: Medik8s url: https://www.medik8s.io/ + replaces: self-node-remediation.v0.0.0 version: 0.0.0