Skip to content

Commit

Permalink
Makefile: set CSV 'replaces' on prepare-release
Browse files Browse the repository at this point in the history
This updates and relocates the 'sed' command updating the 'replaces' key
on the CSV file.

For some reason, the variable PREVIOUS_VERSION is updated after
bundle is updated with the next version's number.
After the 'bundle' target is executed the value of PREVIOUS_VERSION
during execution of 'bundle-image' target is updated because apparently
'utils/get-current-version.sh' is executed again.
  • Loading branch information
yuumasato committed May 27, 2024
1 parent 893ea06 commit 08a2c60
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ GIT_OPTS?=
# We rely on a bash script for this since it's simplier than interating over a
# list with conditionals in GNU make.
GIT_REMOTE?=$(shell ./utils/git-remote.sh)

# PREVIOUS_VERSION gets redefined when the version in $(BUNDLE_CSV_FILE) is bumped
PREVIOUS_VERSION?=$(shell ./utils/get-current-version.sh)

# Image variables
Expand Down Expand Up @@ -440,6 +442,9 @@ bundle: check-operator-version operator-sdk manifests update-skip-range kustomiz
sed -i 's%../default-bundle%../openshift-bundle%' config/manifests/kustomization.yaml; \
fi
$(KUSTOMIZE) build config/manifests | $(SDK_BIN) generate bundle -q $(BUNDLE_SA_OPTS) --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
# As soon as the CSV version is updated the PREVIOUS_VERSION will be updated too
# So we update the replaces now, to ensure the correct value is set
sed -i "s/\(replaces: \).*/\1$(APP_NAME).v$(PREVIOUS_VERSION)/" $(BUNDLE_CSV_FILE)
git restore config/manifests/kustomization.yaml
@echo "Replacing RELATED_IMAGE_OPERATOR env reference in $(BUNDLE_CSV_FILE)"
@sed -i 's%$(DEFAULT_OPERATOR_IMAGE)%$(OPERATOR_IMAGE)%' $(BUNDLE_CSV_FILE)
Expand Down Expand Up @@ -674,7 +679,6 @@ package-version-to-tag: check-operator-version ## Explicitly override $TAG with
.PHONY: git-release
git-release: fetch-git-tags package-version-to-tag changelog ## Update project files with new version information.
git checkout -b "release-v$(TAG)"
sed -i "s/\(replaces: \).*/\1$(PREVIOUS_VERSION)/" $(BUNDLE_CSV_FILE)
sed -i "s/\(.*Version = \"\).*/\1$(TAG)\"/" version/version.go
sed -i "s/\(.*VERSION?=\).*/\1$(TAG)/" version.Makefile
git add version* bundle CHANGELOG.md config/manifests/bases
Expand Down

0 comments on commit 08a2c60

Please sign in to comment.