Skip to content

Commit

Permalink
[catalog] Adding the replaces directive to the generated catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
didierofrivia committed Sep 27, 2023
1 parent dec689f commit ba5a49d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions make/catalog.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ $(CATALOG_FILE): $(OPM) $(YQ)
@echo "************************************************************"
@echo Build limitador operator catalog
@echo
@echo BUNDLE_IMG = $(BUNDLE_IMG)
@echo CHANNELS = $(CHANNELS)
@echo BUNDLE_IMG = $(BUNDLE_IMG)
@echo REPLACES = $(REPLACES)
@echo CHANNELS = $(CHANNELS)
@echo "************************************************************"
@echo
@echo Please check this matches your expectations and override variables if needed.
@echo
$(PROJECT_PATH)/utils/generate-catalog.sh $(OPM) $(YQ) $(BUNDLE_IMG) $(CHANNELS) $@
$(PROJECT_PATH)/utils/generate-catalog.sh $(OPM) $(YQ) $(BUNDLE_IMG) $(REPLACES) $(CHANNELS) $@

.PHONY: catalog
catalog: $(OPM) ## Generate catalog content and validate.
Expand Down
4 changes: 3 additions & 1 deletion utils/generate-catalog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ DEFAULT_CHANNEL=preview
OPM="${1?:Error \$OPM not set. Bye}"
YQ="${2?:Error \$YQ not set. Bye}"
BUNDLE_IMG="${3?:Error \$BUNDLE_IMG not set. Bye}"
REPLACES="${3?:Error \$REPLACES not set. Bye}"
CHANNELS="${4:-$DEFAULT_CHANNEL}"
CATALOG_FILE="${5?:Error \$CATALOG_FILE not set. Bye}"

Expand All @@ -34,7 +35,8 @@ ${OPM} init limitador-operator --default-channel=${CHANNELS} --output yaml >> ${
cat ${TMP_DIR}/limitador-operator-bundle.yaml >> ${CATALOG_FILE}
# Add a channel entry for the bundle
V=`${YQ} eval '.name' ${TMP_DIR}/limitador-operator-bundle.yaml` \
REPLACES=limitador-operator.v${REPLACES_VERSION} \
CHANNELS=${CHANNELS} \
${YQ} eval '(.entries[0].name = strenv(V)) | (.name = strenv(CHANNELS))' ${CATALOG_BASEDIR}/limitador-operator-channel-entry.yaml >> ${CATALOG_FILE}
${YQ} eval '(.entries[0].name = strenv(V)) | (.entries[0].replaces = strenv(REPLACES)) | (.name = strenv(CHANNELS))' ${CATALOG_BASEDIR}/limitador-operator-channel-entry.yaml >> ${CATALOG_FILE}

rm -rf $TMP_DIR

0 comments on commit ba5a49d

Please sign in to comment.