Skip to content

Commit

Permalink
Merge pull request #108 from razo7/replace-annotation
Browse files Browse the repository at this point in the history
Set Replace Annotation
  • Loading branch information
openshift-merge-bot[bot] committed Dec 31, 2023
2 parents e3f8d3f + c9afe4a commit 9bfe371
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
22 changes: 16 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export DEFAULT_CHANNEL
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= $(DEFAULT_VERSION)
PREVIOUS_VERSION ?= $(DEFAULT_VERSION)
export VERSION

# CHANNELS define the bundle channels used in the bundle.
Expand Down Expand Up @@ -197,21 +198,30 @@ bundle-run: operator-sdk ## Run bundle image. Default NS is "openshift-operators
## Some addition to bundle creation in the bundle
DEFAULT_ICON_BASE64 := $(shell base64 --wrap=0 ./config/assets/nmo_blue_icon.png)
export ICON_BASE64 ?= ${DEFAULT_ICON_BASE64}
export BUNDLE_CSV ?= "./bundle/manifests/$(OPERATOR_NAME)-operator.clusterserviceversion.yaml"

.PHONY: bundle-update
bundle-update: ## Update containerImage, createdAt, and icon fields in the bundle's CSV
sed -r -i "s|containerImage: .*|containerImage: $(IMG)|;" ./bundle/manifests/$(OPERATOR_NAME)-operator.clusterserviceversion.yaml
sed -r -i "s|createdAt: .*|createdAt: `date '+%Y-%m-%d %T'`|;" ./bundle/manifests/$(OPERATOR_NAME)-operator.clusterserviceversion.yaml
sed -r -i "s|base64data:.*|base64data: ${ICON_BASE64}|;" ./bundle/manifests/$(OPERATOR_NAME)-operator.clusterserviceversion.yaml
bundle-update: verify-previous-version ## Update CSV fields and validate the bundle directory
sed -r -i "s|containerImage: .*|containerImage: $(IMG)|;" ${BUNDLE_CSV}
sed -r -i "s|createdAt: .*|createdAt: `date '+%Y-%m-%d %T'`|;" ${BUNDLE_CSV}
sed -r -i "s|replaces: .*|replaces: $(OPERATOR_NAME)-operator.v${PREVIOUS_VERSION}|;" ${BUNDLE_CSV}
sed -r -i "s|base64data:.*|base64data: ${ICON_BASE64}|;" ${BUNDLE_CSV}
$(MAKE) bundle-validate

.PHONY: verify-previous-version
verify-previous-version: ## Verifies that PREVIOUS_VERSION variable is set
@if [ $(VERSION) != $(DEFAULT_VERSION) ] && [ $(PREVIOUS_VERSION) = $(DEFAULT_VERSION) ]; then \
echo "Error: PREVIOUS_VERSION must be set for the selected VERSION"; \
exit 1; \
fi

.PHONY: bundle-reset-date
bundle-reset-date: ## Reset bundle's createdAt
sed -r -i "s|createdAt: .*|createdAt: \"\"|;" ./bundle/manifests/$(OPERATOR_NAME)-operator.clusterserviceversion.yaml
sed -r -i "s|createdAt: .*|createdAt: \"\"|;" ${BUNDLE_CSV}

.PHONY: bundle-community
bundle-community: bundle-k8s ## Update displayName, and description fields in the bundle's CSV
sed -r -i "s|displayName: Node Maintenance Operator|displayName: Node Maintenance Operator - Community Edition |;" ./bundle/manifests/$(OPERATOR_NAME)-operator.clusterserviceversion.yaml
sed -r -i "s|displayName: Node Maintenance Operator|displayName: Node Maintenance Operator - Community Edition |;" ${BUNDLE_CSV}
$(MAKE) bundle-update

##@ Build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ spec:
provider:
name: Medik8s
url: https://github.com/medik8s
replaces: node-maintenance-operator.v0.0.1
version: 0.0.1
webhookdefinitions:
- admissionReviewVersions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,5 @@ spec:
provider:
name: Medik8s
url: https://github.com/medik8s
replaces: node-maintenance-operator.v0.0.1
version: 0.0.0

0 comments on commit 9bfe371

Please sign in to comment.