diff --git a/.github/workflows/build-images-base.yaml b/.github/workflows/build-images-base.yaml index e4132b14..707fc2a6 100644 --- a/.github/workflows/build-images-base.yaml +++ b/.github/workflows/build-images-base.yaml @@ -15,6 +15,10 @@ on: description: Limitador version default: latest type: string + channels: + description: Bundle and catalog channels, comma separated + default: preview + type: string workflow_dispatch: inputs: operatorVersion: @@ -29,6 +33,10 @@ on: description: Limitador version default: latest type: string + channels: + description: Bundle and catalog channels, comma separated + default: preview + type: string env: IMG_TAGS: ${{ github.sha }} ${{ inputs.operatorTag }} @@ -90,8 +98,13 @@ jobs: - name: Run make bundle id: make-bundle run: | - make bundle REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} \ - VERSION=${{ env.VERSION }} IMAGE_TAG=${{ inputs.operatorTag }} LIMITADOR_VERSION=${{ inputs.limitadorVersion }} + make bundle \ + REGISTRY=${{ env.IMG_REGISTRY_HOST }} \ + ORG=${{ env.IMG_REGISTRY_ORG }} \ + VERSION=${{ env.VERSION }} \ + IMAGE_TAG=${{ inputs.operatorTag }} \ + LIMITADOR_VERSION=${{ inputs.limitadorVersion }} \ + CHANNELS=${{ inputs.channels }} - name: Build Image id: build-image uses: redhat-actions/buildah-build@v2 @@ -128,8 +141,11 @@ jobs: uses: actions/checkout@v3 - name: Generate Catalog Content run: | - make catalog REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} \ - VERSION=${{ env.VERSION }} IMAGE_TAG=${{ inputs.operatorTag }} LIMITADOR_VERSION=${{ inputs.limitadorVersion }} + make catalog \ + REGISTRY=${{ env.IMG_REGISTRY_HOST }} ORG=${{ env.IMG_REGISTRY_ORG }} \ + VERSION=${{ env.VERSION }} IMAGE_TAG=${{ inputs.operatorTag }} \ + LIMITADOR_VERSION=${{ inputs.limitadorVersion }} \ + CHANNELS=${{ inputs.channels }} - name: Install qemu dependency run: | sudo apt-get update diff --git a/make/catalog.mk b/make/catalog.mk index 46040bfd..a25f7183 100644 --- a/make/catalog.mk +++ b/make/catalog.mk @@ -16,11 +16,12 @@ $(CATALOG_FILE): $(OPM) $(YQ) @echo Build limitador operator catalog @echo @echo BUNDLE_IMG = $(BUNDLE_IMG) + @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) $@ + $(PROJECT_PATH)/utils/generate-catalog.sh $(OPM) $(YQ) $(BUNDLE_IMG) $(CHANNELS) $@ .PHONY: catalog catalog: $(OPM) ## Generate catalog content and validate. diff --git a/utils/generate-catalog.sh b/utils/generate-catalog.sh index 666470b5..19938429 100755 --- a/utils/generate-catalog.sh +++ b/utils/generate-catalog.sh @@ -6,13 +6,14 @@ set -euo pipefail ### CONSTANTS # Used as well in the subscription object -CHANNEL_NAME=preview +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}" -CATALOG_FILE="${4?:Error \$CATALOG_FILE not set. Bye}" +CHANNELS="${4:-$DEFAULT_CHANNEL}" +CATALOG_FILE="${5?:Error \$CATALOG_FILE not set. Bye}" CATALOG_FILE_BASEDIR="$( cd "$( dirname "$(realpath ${CATALOG_FILE})" )" && pwd )" CATALOG_BASEDIR="$( cd "$( dirname "$(realpath ${CATALOG_FILE_BASEDIR})" )" && pwd )" @@ -28,11 +29,12 @@ touch ${CATALOG_FILE} # Limitador Operator ### # Add the package -${OPM} init limitador-operator --default-channel=${CHANNEL_NAME} --output yaml >> ${CATALOG_FILE} +${OPM} init limitador-operator --default-channel=${CHANNELS} --output yaml >> ${CATALOG_FILE} # Add a bundles to the Catalog 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` \ - ${YQ} eval '(.entries[0].name = strenv(V))' ${CATALOG_BASEDIR}/limitador-operator-channel-entry.yaml >> ${CATALOG_FILE} +CHANNELS=${CHANNELS} \ + ${YQ} eval '(.entries[0].name = strenv(V)) | (.name = strenv(CHANNELS))' ${CATALOG_BASEDIR}/limitador-operator-channel-entry.yaml >> ${CATALOG_FILE} rm -rf $TMP_DIR